Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions library/std/src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.shutdown(Shutdown::Both).expect("shutdown call failed");
/// stream.shutdown(Shutdown::Both).expect("shutdown should succeed");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
Expand All @@ -260,7 +260,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// let stream_clone = stream.try_clone().expect("clone failed...");
/// let stream_clone = stream.try_clone().expect("clone should succeed");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn try_clone(&self) -> io::Result<TcpStream> {
Expand Down Expand Up @@ -290,7 +290,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_read_timeout(None).expect("set_read_timeout call failed");
/// stream.set_read_timeout(None).expect("set_read_timeout should succeed");
/// ```
///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this
Expand Down Expand Up @@ -334,7 +334,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_write_timeout(None).expect("set_write_timeout call failed");
/// stream.set_write_timeout(None).expect("set_write_timeout should succeed");
/// ```
///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this
Expand Down Expand Up @@ -372,7 +372,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_read_timeout(None).expect("set_read_timeout call failed");
/// stream.set_read_timeout(None).expect("set_read_timeout should succeed");
/// assert_eq!(stream.read_timeout().unwrap(), None);
/// ```
#[stable(feature = "socket_timeout", since = "1.4.0")]
Expand All @@ -397,7 +397,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_write_timeout(None).expect("set_write_timeout call failed");
/// stream.set_write_timeout(None).expect("set_write_timeout should succeed");
/// assert_eq!(stream.write_timeout().unwrap(), None);
/// ```
#[stable(feature = "socket_timeout", since = "1.4.0")]
Expand All @@ -420,7 +420,7 @@ impl TcpStream {
/// let stream = TcpStream::connect("127.0.0.1:8000")
/// .expect("Couldn't connect to the server...");
/// let mut buf = [0; 10];
/// let len = stream.peek(&mut buf).expect("peek failed");
/// let len = stream.peek(&mut buf).expect("peek should succeed");
/// ```
#[stable(feature = "peek", since = "1.18.0")]
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
Expand All @@ -445,7 +445,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_linger(Some(Duration::from_secs(0))).expect("set_linger call failed");
/// stream.set_linger(Some(Duration::from_secs(0))).expect("set_linger should succeed");
/// ```
#[unstable(feature = "tcp_linger", issue = "88494")]
pub fn set_linger(&self, linger: Option<Duration>) -> io::Result<()> {
Expand All @@ -466,7 +466,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_linger(Some(Duration::from_secs(0))).expect("set_linger call failed");
/// stream.set_linger(Some(Duration::from_secs(0))).expect("set_linger should succeed");
/// assert_eq!(stream.linger().unwrap(), Some(Duration::from_secs(0)));
/// ```
#[unstable(feature = "tcp_linger", issue = "88494")]
Expand Down Expand Up @@ -498,7 +498,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_keepalive(true).expect("set_keepalive call failed");
/// stream.set_keepalive(true).expect("set_keepalive should succeed");
#[unstable(feature = "tcp_keepalive", issue = "155889")]
pub fn set_keepalive(&self, keepalive: bool) -> io::Result<()> {
self.0.set_keepalive(keepalive)
Expand All @@ -517,7 +517,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_keepalive(true).expect("set_keepalive call failed");
/// stream.set_keepalive(true).expect("set_keepalive should succeed");
/// assert_eq!(stream.keepalive().unwrap_or(false), true);
/// ```
#[unstable(feature = "tcp_keepalive", issue = "155889")]
Expand All @@ -540,7 +540,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_nodelay(true).expect("set_nodelay call failed");
/// stream.set_nodelay(true).expect("set_nodelay should succeed");
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> {
Expand All @@ -558,7 +558,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_nodelay(true).expect("set_nodelay call failed");
/// stream.set_nodelay(true).expect("set_nodelay should succeed");
/// assert_eq!(stream.nodelay().unwrap_or(false), true);
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
Expand All @@ -578,7 +578,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_ttl(100).expect("set_ttl call failed");
/// stream.set_ttl(100).expect("set_ttl should succeed");
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
pub fn set_ttl(&self, ttl: u32) -> io::Result<()> {
Expand All @@ -596,7 +596,7 @@ impl TcpStream {
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_ttl(100).expect("set_ttl call failed");
/// stream.set_ttl(100).expect("set_ttl should succeed");
/// assert_eq!(stream.ttl().unwrap_or(0), 100);
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
Expand Down Expand Up @@ -647,7 +647,7 @@ impl TcpStream {
///
/// let mut stream = TcpStream::connect("127.0.0.1:7878")
/// .expect("Couldn't connect to the server...");
/// stream.set_nonblocking(true).expect("set_nonblocking call failed");
/// stream.set_nonblocking(true).expect("set_nonblocking should succeed");
///
/// # fn wait_for_fd() { unimplemented!() }
/// let mut buf = vec![];
Expand Down Expand Up @@ -1006,7 +1006,7 @@ impl TcpListener {
/// use std::net::TcpListener;
///
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
/// listener.set_ttl(100).expect("could not set TTL");
/// listener.set_ttl(100).expect("set_ttl should succeed");
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
pub fn set_ttl(&self, ttl: u32) -> io::Result<()> {
Expand All @@ -1023,7 +1023,7 @@ impl TcpListener {
/// use std::net::TcpListener;
///
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
/// listener.set_ttl(100).expect("could not set TTL");
/// listener.set_ttl(100).expect("set_ttl should succeed");
/// assert_eq!(listener.ttl().unwrap_or(0), 100);
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
Expand Down Expand Up @@ -1086,7 +1086,7 @@ impl TcpListener {
/// use std::net::TcpListener;
///
/// let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
/// listener.set_nonblocking(true).expect("Cannot set non-blocking");
/// listener.set_nonblocking(true).expect("set_nonblocking should succeed");
///
/// # fn wait_for_fd() { unimplemented!() }
/// # fn handle_connection(stream: std::net::TcpStream) { unimplemented!() }
Expand Down
Loading