Skip to content

Commit

Permalink
task: fix warning (#4960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Aug 31, 2022
1 parent adc774b commit 01ebb0a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions tokio/src/signal/windows/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,40 +188,40 @@ mod tests {
}

#[test]
fn ctrl_shutdown() {
let rt = rt();
fn ctrl_shutdown() {
let rt = rt();

rt.block_on(async {
let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown());
rt.block_on(async {
let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown());

// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(wincon::CTRL_SHUTDOWN_EVENT);
}
// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(wincon::CTRL_SHUTDOWN_EVENT);
}

ctrl_shutdown.recv().await.unwrap();
});
}
ctrl_shutdown.recv().await.unwrap();
});
}

#[test]
fn ctrl_logoff() {
let rt = rt();

rt.block_on(async {
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());

// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(wincon::CTRL_LOGOFF_EVENT);
}

ctrl_logoff.recv().await.unwrap();
});
}
fn ctrl_logoff() {
let rt = rt();

rt.block_on(async {
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());

// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(wincon::CTRL_LOGOFF_EVENT);
}

ctrl_logoff.recv().await.unwrap();
});
}

fn rt() -> Runtime {
crate::runtime::Builder::new_current_thread()
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/task/join_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl<'a, T: 'static> Builder<'a, T> {
/// [`AbortHandle`]: crate::task::AbortHandle
/// [runtime handle]: crate::runtime::Handle
#[track_caller]
pub fn spawn_on<F>(mut self, future: F, handle: &Handle) -> std::io::Result<AbortHandle>
pub fn spawn_on<F>(self, future: F, handle: &Handle) -> std::io::Result<AbortHandle>
where
F: Future<Output = T>,
F: Send + 'static,
Expand Down

0 comments on commit 01ebb0a

Please sign in to comment.