mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
task: stabilise JoinMap (#7075)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(all(feature = "rt", tokio_unstable))]
|
||||
#![cfg(feature = "join-map")]
|
||||
|
||||
use std::panic::AssertUnwindSafe;
|
||||
|
||||
@@ -26,7 +26,7 @@ async fn test_with_sleep() {
|
||||
map.detach_all();
|
||||
assert_eq!(map.len(), 0);
|
||||
|
||||
assert!(matches!(map.join_next().await, None));
|
||||
assert!(map.join_next().await.is_none());
|
||||
|
||||
for i in 0..10 {
|
||||
map.spawn(i, async move {
|
||||
@@ -45,7 +45,7 @@ async fn test_with_sleep() {
|
||||
for was_seen in &seen {
|
||||
assert!(was_seen);
|
||||
}
|
||||
assert!(matches!(map.join_next().await, None));
|
||||
assert!(map.join_next().await.is_none());
|
||||
|
||||
// Do it again.
|
||||
for i in 0..10 {
|
||||
@@ -64,7 +64,7 @@ async fn test_with_sleep() {
|
||||
for was_seen in &seen {
|
||||
assert!(was_seen);
|
||||
}
|
||||
assert!(matches!(map.join_next().await, None));
|
||||
assert!(map.join_next().await.is_none());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -250,7 +250,7 @@ async fn join_map_coop() {
|
||||
loop {
|
||||
match map.join_next().now_or_never() {
|
||||
Some(Some((key, Ok(i)))) => assert_eq!(key, i),
|
||||
Some(Some((key, Err(err)))) => panic!("failed[{}]: {}", key, err),
|
||||
Some(Some((key, Err(err)))) => panic!("failed[{key}]: {err}"),
|
||||
None => {
|
||||
coop_count += 1;
|
||||
tokio::task::yield_now().await;
|
||||
|
||||
Reference in New Issue
Block a user