From 502cb6f4b9ccb4ead43b76949252bf087b6d2c05 Mon Sep 17 00:00:00 2001 From: Sergei Belokon Date: Thu, 6 Apr 2023 18:32:01 +1000 Subject: [PATCH] chore(tcp): change the hardcoded port number to `port` var The `listen_on` function in the example has a `port` option but doesn't use it --- library/std/src/net/tcp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index 3982d3636614e..6a5f2923210d8 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -869,7 +869,7 @@ impl TcpListener { /// 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 */ /// }