Skip to content

Commit ca96892

Browse files
committed
Clean up TcpStream example
Fixes rust-lang#35950
1 parent 15ce540 commit ca96892

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libstd/net/tcp.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub struct TcpStream(net_imp::TcpStream);
7373
/// # Examples
7474
///
7575
/// ```no_run
76+
/// # use std::io;
7677
/// use std::net::{TcpListener, TcpStream};
7778
///
7879
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
@@ -81,15 +82,13 @@ pub struct TcpStream(net_imp::TcpStream);
8182
/// // ...
8283
/// }
8384
///
85+
/// # fn process() -> io::Result<()> {
8486
/// // accept connections and process them serially
8587
/// for stream in listener.incoming() {
86-
/// match stream {
87-
/// Ok(stream) => {
88-
/// handle_client(stream);
89-
/// }
90-
/// Err(e) => { /* connection failed */ }
91-
/// }
88+
/// handle_client(stream?);
9289
/// }
90+
/// # Ok(())
91+
/// # }
9392
/// ```
9493
#[stable(feature = "rust1", since = "1.0.0")]
9594
pub struct TcpListener(net_imp::TcpListener);

0 commit comments

Comments
 (0)