Skip to content

Commit 502cb6f

Browse files
committed
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
1 parent 7f6edd3 commit 502cb6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/net/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ impl TcpListener {
869869
/// use std::net::{TcpListener, TcpStream};
870870
///
871871
/// fn listen_on(port: u16) -> impl Iterator<Item = TcpStream> {
872-
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
872+
/// let listener = TcpListener::bind(format!("127.0.0.1:{port}")).unwrap();
873873
/// listener.into_incoming()
874874
/// .filter_map(Result::ok) /* Ignore failed connections */
875875
/// }

0 commit comments

Comments
 (0)