diff options
| author | bors <bors@rust-lang.org> | 2017-10-07 12:13:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-10-07 12:13:28 +0000 |
| commit | bb4d1491466d8239a7a5fd68bd605e3276e97afb (patch) | |
| tree | 7bc523ced1bfc32c251a8f87f928858a6c8b3e8f /src/libstd | |
| parent | d2f71bf23f67b18fbdb64f1173af1a0ddc649421 (diff) | |
| parent | 6482ee7cde565a432980036abe521e86bff432bd (diff) | |
| download | rust-bb4d1491466d8239a7a5fd68bd605e3276e97afb.tar.gz rust-bb4d1491466d8239a7a5fd68bd605e3276e97afb.zip | |
Auto merge of #44913 - leavehouse:patch-1, r=BurntSushi
Fix TcpStream::local_addr docs example code The local address's port is not 8080 in this example, that's the remote peer address port. On my machine, the local address is different every time, so I've changed `assert_eq` to only test the IP address
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/net/tcp.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 8d1e7882e5d..b904641a336 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -194,12 +194,12 @@ impl TcpStream { /// # Examples /// /// ```no_run - /// use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpStream}; + /// use std::net::{IpAddr, Ipv4Addr, TcpStream}; /// /// let stream = TcpStream::connect("127.0.0.1:8080") /// .expect("Couldn't connect to the server..."); - /// assert_eq!(stream.local_addr().unwrap(), - /// SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080))); + /// assert_eq!(stream.local_addr().unwrap().ip(), + /// IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn local_addr(&self) -> io::Result<SocketAddr> { |
