diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index 3982d363661..6a5f2923210 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -869,7 +869,7 @@ pub fn incoming(&self) -> Incoming<'_> { /// use std::net::{TcpListener, TcpStream}; /// /// fn listen_on(port: u16) -> impl Iterator { - /// let listener = TcpListener::bind("127.0.0.1:80").unwrap(); + /// let listener = TcpListener::bind(format!("127.0.0.1:{port}")).unwrap(); /// listener.into_incoming() /// .filter_map(Result::ok) /* Ignore failed connections */ /// }