about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-10-25 14:30:59 +0200
committerGitHub <noreply@github.com>2018-10-25 14:30:59 +0200
commit699f591a16181b6fa77411104ce609138dc5ce80 (patch)
tree9380f3467936fcf877e64fb8fed78fca2d9e75a0 /src/libstd
parent3bcfa070218e0cb8c76f69636605e8b6a9e2a907 (diff)
parent4530b8c56cb7c1e539472e09c1e2704f67814912 (diff)
downloadrust-699f591a16181b6fa77411104ce609138dc5ce80.tar.gz
rust-699f591a16181b6fa77411104ce609138dc5ce80.zip
Rollup merge of #54965 - chathaway-codes:update-tcp-stream-docs, r=GuillaumeGomez
update tcp stream documentation

A small styling issue that seemed inconsistent here when compared to other places (such as https://doc.rust-lang.org/beta/std/net/struct.TcpListener.html).
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/net/tcp.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index 75c7a3d9280..ad212a54757 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -43,12 +43,12 @@ use time::Duration;
 /// use std::io::prelude::*;
 /// use std::net::TcpStream;
 ///
-/// {
-///     let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap();
+/// fn main() -> std::io::Result<()> {
+///     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])?;
+///     Ok(())
 /// } // the stream is closed here
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]