diff options
| author | leavehouse <heavelouse@gmail.com> | 2017-09-28 20:09:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-28 20:09:31 -0500 |
| commit | 7f9e653a299209c17d0093934973fc121e972d29 (patch) | |
| tree | 422802156226af28e9362a1260e8de9644e1ebe8 /src/libstd | |
| parent | 3c96d40d326b64f6a50f4a902051fe71c4acdc92 (diff) | |
| download | rust-7f9e653a299209c17d0093934973fc121e972d29.tar.gz rust-7f9e653a299209c17d0093934973fc121e972d29.zip | |
Fix TcpStream::local_addr 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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index aff9af66444..2497f38f38c 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -198,8 +198,8 @@ impl 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> { |
