Skip to content

Commit 7975b08

Browse files
use if let when able
Co-authored-by: Bruce Guenter <[email protected]>
1 parent 0d9fbcd commit 7975b08

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/vector-common/src/shutdown.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ impl SourceShutdownCoordinator {
301301
) -> impl Future<Output = bool> {
302302
async move {
303303
let fut = shutdown_complete_tripwire.then(tripwire_handler);
304-
if deadline.is_some() {
304+
if let Some(deadline) = deadline {
305305
// Call `shutdown_force_trigger.disable()` on drop.
306306
let shutdown_force_trigger = DisabledTrigger::new(shutdown_force_trigger);
307-
if timeout_at(deadline.unwrap(), fut).await.is_ok() {
307+
if timeout_at(deadline, fut).await.is_ok() {
308308
shutdown_force_trigger.into_inner().disable();
309309
true
310310
} else {

src/topology/running.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ impl RunningTopology {
130130
.graceful_shutdown_duration
131131
.map(|grace_period| Instant::now() + grace_period);
132132

133-
let timeout = if deadline.is_some() {
133+
let timeout = if let Some(deadline) = deadline {
134134
// If we reach the deadline, this future will print out which components
135135
// won't gracefully shutdown since we will start to forcefully shutdown
136136
// the sources.
137137
let mut check_handles2 = check_handles.clone();
138138
Box::pin(async move {
139-
sleep_until(deadline.unwrap()).await;
139+
sleep_until(deadline).await;
140140
// Remove all tasks that have shutdown.
141141
check_handles2.retain(|_key, handles| {
142142
retain(handles, |handle| handle.peek().is_none());

0 commit comments

Comments
 (0)