task: fix warning (#4960)

This commit is contained in:
Alice Ryhl 2022-08-31 15:42:30 +02:00 committed by GitHub
parent adc774bc4f
commit 01ebb0aa29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 27 deletions

View File

@ -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();
fn ctrl_logoff() {
let rt = rt();
rt.block_on(async {
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());
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);
}
// 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();
});
}
ctrl_logoff.recv().await.unwrap();
});
}
fn rt() -> Runtime {
crate::runtime::Builder::new_current_thread()

View File

@ -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,