simplify select_second
Some checks failed
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.65) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.

This commit is contained in:
AF 2023-10-15 17:41:21 +00:00
parent 7ed5e9f255
commit 787efb3662
2 changed files with 6 additions and 11 deletions

View File

@ -176,13 +176,11 @@ mod future_tests {
#[test] #[test]
fn select_second() { fn select_second() {
match futures::executor::block_on(T::select( let res = futures::executor::block_on(T::select(
Box::pin(futures::future::pending::<i32>()), Box::pin(futures::future::pending::<i32>()),
Box::pin(futures::future::ready(2)), Box::pin(futures::future::ready(2)),
)) { ));
Selected::A(_, _) => panic!("first future ready"), assert!(matches!(res, Selected::B(_, 2)));
Selected::B(_, b) => assert_eq!(b, 2),
}
} }
#[test] #[test]

View File

@ -246,15 +246,12 @@ mod tryfuture_tests {
#[test] #[test]
fn select_second() { fn select_second() {
match futures::executor::block_on(T::select( let res = futures::executor::block_on(T::select(
Box::pin(futures::future::pending::<Result<i32, _>>()), Box::pin(futures::future::pending::<Result<i32, _>>()),
Box::pin(futures::future::ready(Ok(2))), Box::pin(futures::future::ready(Ok(2))),
)) ))
.unwrap() .unwrap();
{ assert!(matches!(res, Selected::B(_, 2)));
Selected::A(_, _) => panic!("first future ready"),
Selected::B(_, b) => assert_eq!(b, 2),
}
} }
#[test] #[test]