Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: fix warning #4960

Merged
merged 2 commits into from Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 29 additions & 29 deletions tokio/src/signal/windows/sys.rs
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
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