Skip to content

Commit

Permalink
fix cargo clippy
Browse files Browse the repository at this point in the history
Signed-off-by: xuanyuan300 <[email protected]>
  • Loading branch information
xuanyuan300 authored and theduke committed Dec 13, 2023
1 parent a6af4b3 commit 32e1537
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/wasix/src/runtime/task_manager/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl VirtualTaskManager for TokioTaskManager {
.enter(handle, time)
.await
.ok()
.unwrap_or_else(|| ())
.unwrap_or(())
})
}

Expand Down Expand Up @@ -208,6 +208,7 @@ impl VirtualTaskManager for TokioTaskManager {
}

// Used by [`VirtualTaskManager::sleep_now`] to abort a sleep task when drop.
#[derive(Default)]
struct SleepNow {
abort_handle: Option<tokio::task::AbortHandle>,
}
Expand All @@ -230,14 +231,10 @@ impl SleepNow {
}
}

impl Default for SleepNow {
fn default() -> Self {
Self { abort_handle: None }
}
}

impl Drop for SleepNow {
fn drop(&mut self) {
self.abort_handle.as_ref().map(|h| h.abort());
if let Some(h) = self.abort_handle.as_ref() {
h.abort()
}
}
}

0 comments on commit 32e1537

Please sign in to comment.