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] #[test]
fn ctrl_shutdown() { fn ctrl_shutdown() {
let rt = rt(); let rt = rt();
rt.block_on(async { rt.block_on(async {
let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown()); let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown());
// Windows doesn't have a good programmatic way of sending events // Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS // like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works. // integration and test that our handling works.
unsafe { unsafe {
super::handler(wincon::CTRL_SHUTDOWN_EVENT); super::handler(wincon::CTRL_SHUTDOWN_EVENT);
} }
ctrl_shutdown.recv().await.unwrap(); ctrl_shutdown.recv().await.unwrap();
}); });
} }
#[test] #[test]
fn ctrl_logoff() { fn ctrl_logoff() {
let rt = rt(); let rt = rt();
rt.block_on(async { rt.block_on(async {
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()); let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());
// Windows doesn't have a good programmatic way of sending events // Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS // like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works. // integration and test that our handling works.
unsafe { unsafe {
super::handler(wincon::CTRL_LOGOFF_EVENT); super::handler(wincon::CTRL_LOGOFF_EVENT);
} }
ctrl_logoff.recv().await.unwrap(); ctrl_logoff.recv().await.unwrap();
}); });
} }
fn rt() -> Runtime { fn rt() -> Runtime {
crate::runtime::Builder::new_current_thread() crate::runtime::Builder::new_current_thread()

View File

@ -439,7 +439,7 @@ impl<'a, T: 'static> Builder<'a, T> {
/// [`AbortHandle`]: crate::task::AbortHandle /// [`AbortHandle`]: crate::task::AbortHandle
/// [runtime handle]: crate::runtime::Handle /// [runtime handle]: crate::runtime::Handle
#[track_caller] #[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 where
F: Future<Output = T>, F: Future<Output = T>,
F: Send + 'static, F: Send + 'static,