diff --git a/docs/src/tutorial/handling_disconnection.md b/docs/src/tutorial/handling_disconnection.md index 21f67ab0..e1eb8e9f 100644 --- a/docs/src/tutorial/handling_disconnection.md +++ b/docs/src/tutorial/handling_disconnection.md @@ -94,11 +94,11 @@ async fn client_writer( let mut shutdown = shutdown.fuse(); loop { // 2 select! { - msg = messages.next() => match msg { + msg = messages.next().fuse() => match msg { Some(msg) => stream.write_all(msg.as_bytes()).await?, None => break, }, - void = shutdown.next() => match void { + void = shutdown.next().fuse() => match void { Some(void) => match void {}, // 3 None => break, } @@ -210,11 +210,11 @@ async fn client_writer( let mut shutdown = shutdown.fuse(); loop { select! { - msg = messages.next() => match msg { + msg = messages.next().fuse() => match msg { Some(msg) => stream.write_all(msg.as_bytes()).await?, None => break, }, - void = shutdown.next() => match void { + void = shutdown.next().fuse() => match void { Some(void) => match void {}, None => break, } @@ -244,11 +244,11 @@ async fn broker(events: Receiver) { let mut events = events.fuse(); loop { let event = select! { - event = events.next() => match event { + event = events.next().fuse() => match event { None => break, // 2 Some(event) => event, }, - disconnect = disconnect_receiver.next() => { + disconnect = disconnect_receiver.next().fuse() => { let (name, _pending_messages) = disconnect.unwrap(); // 3 assert!(peers.remove(&name).is_some()); continue; diff --git a/src/stream/stream/fuse.rs b/src/stream/stream/fuse.rs index 13850c5a..35419370 100644 --- a/src/stream/stream/fuse.rs +++ b/src/stream/stream/fuse.rs @@ -31,9 +31,3 @@ impl futures_core::Stream for Fuse { } } } - -impl futures_core::stream::FusedStream for Fuse { - fn is_terminated(&self) -> bool { - self.done - } -}