From c36ccf7912a1dd229cda0c2443cad31c0e5f8fd6 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 30 Aug 2016 06:42:56 +0200 Subject: [PATCH] doc: make TcpListener example more simple --- src/libstd/net/tcp.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index dcd3652af87..3c5f07c3e33 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -45,7 +45,6 @@ pub struct TcpStream(net_imp::TcpStream); /// /// ```no_run /// use std::net::{TcpListener, TcpStream}; -/// use std::thread; /// /// let listener = TcpListener::bind("127.0.0.1:80").unwrap(); /// @@ -57,17 +56,11 @@ pub struct TcpStream(net_imp::TcpStream); /// for stream in listener.incoming() { /// match stream { /// Ok(stream) => { -/// thread::spawn(move|| { -/// // connection succeeded -/// handle_client(stream) -/// }); +/// handle_client(stream); /// } /// Err(e) => { /* connection failed */ } /// } /// } -/// -/// // close the socket server -/// drop(listener); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub struct TcpListener(net_imp::TcpListener);