Skip to content

Commit 60c3626

Browse files
authored
Rollup merge of rust-lang#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).
2 parents 28bde7f + 4530b8c commit 60c3626

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/libstd/net/tcp.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ use time::Duration;
4343
/// use std::io::prelude::*;
4444
/// use std::net::TcpStream;
4545
///
46-
/// {
47-
/// let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap();
46+
/// fn main() -> std::io::Result<()> {
47+
/// let mut stream = TcpStream::connect("127.0.0.1:34254")?;
4848
///
49-
/// // ignore the Result
50-
/// let _ = stream.write(&[1]);
51-
/// let _ = stream.read(&mut [0; 128]); // ignore here too
49+
/// stream.write(&[1])?;
50+
/// stream.read(&mut [0; 128])?;
51+
/// Ok(())
5252
/// } // the stream is closed here
5353
/// ```
5454
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)