diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index e870ae5f4..512cca502 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -128,9 +128,9 @@ pub struct Receiver { /// /// tokio::spawn(async move { /// for i in 0..10 { -/// if let Err(_) = tx.send(i).await { +/// if tx.send(i).await.is_err() { /// println!("receiver dropped"); -/// return; +/// break; /// } /// } /// }); @@ -459,9 +459,9 @@ impl Sender { /// /// tokio::spawn(async move { /// for i in 0..10 { - /// if let Err(_) = tx.send(i).await { + /// if tx.send(i).await.is_err() { /// println!("receiver dropped"); - /// return; + /// break; /// } /// } /// }); @@ -630,7 +630,7 @@ impl Sender { /// for i in 0..10 { /// if let Err(e) = tx.send_timeout(i, Duration::from_millis(100)).await { /// println!("send error: #{:?}", e); - /// return; + /// break; /// } /// } /// });