diff --git a/README.md b/README.md index 6ba7d7f44e4..ea81cc7c7a0 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ async fn main() -> Result<(), Box> { loop { let n = match socket.read(&mut buf).await { // socket closed - Ok(n) if n == 0 => return, + Ok(0) => return, Ok(n) => n, Err(e) => { eprintln!("failed to read from socket; err = {:?}", e); diff --git a/tokio/README.md b/tokio/README.md index 6ba7d7f44e4..ea81cc7c7a0 100644 --- a/tokio/README.md +++ b/tokio/README.md @@ -78,7 +78,7 @@ async fn main() -> Result<(), Box> { loop { let n = match socket.read(&mut buf).await { // socket closed - Ok(n) if n == 0 => return, + Ok(0) => return, Ok(n) => n, Err(e) => { eprintln!("failed to read from socket; err = {:?}", e); diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 7b84b54b882..b85921f31de 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -284,7 +284,7 @@ //! loop { //! let n = match socket.read(&mut buf).await { //! // socket closed -//! Ok(n) if n == 0 => return, +//! Ok(0) => return, //! Ok(n) => n, //! Err(e) => { //! eprintln!("failed to read from socket; err = {:?}", e); diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index 82bda0dc597..bc00bc0810d 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -36,7 +36,7 @@ //! loop { //! let n = match socket.read(&mut buf).await { //! // socket closed -//! Ok(n) if n == 0 => return, +//! Ok(0) => return, //! Ok(n) => n, //! Err(e) => { //! println!("failed to read from socket; err = {:?}", e); @@ -84,7 +84,7 @@ //! loop { //! let n = match socket.read(&mut buf).await { //! // socket closed -//! Ok(n) if n == 0 => return, +//! Ok(0) => return, //! Ok(n) => n, //! Err(e) => { //! println!("failed to read from socket; err = {:?}", e);