diff options
| author | Sergei Belokon <srj.belokon@gmail.com> | 2023-04-06 18:32:01 +1000 |
|---|---|---|
| committer | Sergei Belokon <srj.belokon@gmail.com> | 2023-04-06 18:32:01 +1000 |
| commit | 502cb6f4b9ccb4ead43b76949252bf087b6d2c05 (patch) | |
| tree | 8d3cf332ad7fbd5896f605ae541dd8b1fef81d6c | |
| parent | 7f6edd3f15f75f0df70027edee2a520820d14217 (diff) | |
| download | rust-502cb6f4b9ccb4ead43b76949252bf087b6d2c05.tar.gz rust-502cb6f4b9ccb4ead43b76949252bf087b6d2c05.zip | |
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
| -rw-r--r-- | library/std/src/net/tcp.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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 @@ impl TcpListener { /// use std::net::{TcpListener, TcpStream}; /// /// fn listen_on(port: u16) -> impl Iterator<Item = TcpStream> { - /// 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 */ /// } |
