From c514b627e4bea768fe8560b96ce585689d008017 Mon Sep 17 00:00:00 2001 From: Charles Hathaway Date: Wed, 10 Oct 2018 11:13:35 -0400 Subject: [PATCH 1/2] update tcp stream documentation --- src/libstd/net/tcp.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 75c7a3d928094..848570e75e71e 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -44,11 +44,10 @@ use time::Duration; /// use std::net::TcpStream; /// /// { -/// let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap(); +/// let mut stream = TcpStream::connect("127.0.0.1:34254")?; /// -/// // ignore the Result -/// let _ = stream.write(&[1]); -/// let _ = stream.read(&mut [0; 128]); // ignore here too +/// stream.write(&[1])?; +/// stream.read(&mut [0; 128])?; /// } // the stream is closed here /// ``` #[stable(feature = "rust1", since = "1.0.0")] From 4530b8c56cb7c1e539472e09c1e2704f67814912 Mon Sep 17 00:00:00 2001 From: Charles Hathaway Date: Thu, 11 Oct 2018 15:35:48 -0400 Subject: [PATCH 2/2] Small changes to fix documentation auto compile issues --- src/libstd/net/tcp.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 848570e75e71e..ad212a547579b 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -43,11 +43,12 @@ use time::Duration; /// use std::io::prelude::*; /// use std::net::TcpStream; /// -/// { +/// fn main() -> std::io::Result<()> { /// let mut stream = TcpStream::connect("127.0.0.1:34254")?; /// /// stream.write(&[1])?; /// stream.read(&mut [0; 128])?; +/// Ok(()) /// } // the stream is closed here /// ``` #[stable(feature = "rust1", since = "1.0.0")]