about summary refs log tree commit diff
path: root/library/std/src/sys/unix/net.rs
diff options
context:
space:
mode:
authorThom Chiovoloni <chiovolonit@gmail.com>2021-08-08 01:04:33 -0700
committerThom Chiovoloni <chiovolonit@gmail.com>2022-02-04 18:47:29 -0800
commit554918e311a1221744aa9b6d60e2f00f5b3155e5 (patch)
treee8affa7ee0e7729cf05633c7b7989aaaa96bdd8c /library/std/src/sys/unix/net.rs
parent71226d717a1fb57122e47e63b97295e703319cb0 (diff)
downloadrust-554918e311a1221744aa9b6d60e2f00f5b3155e5.tar.gz
rust-554918e311a1221744aa9b6d60e2f00f5b3155e5.zip
Hide Repr details from io::Error, and rework `io::Error::new_const`.
Diffstat (limited to 'library/std/src/sys/unix/net.rs')
-rw-r--r--library/std/src/sys/unix/net.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index a82a0172126..61c15ecd85d 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -154,9 +154,9 @@ impl Socket {
         let mut pollfd = libc::pollfd { fd: self.as_raw_fd(), events: libc::POLLOUT, revents: 0 };
 
         if timeout.as_secs() == 0 && timeout.subsec_nanos() == 0 {
-            return Err(io::Error::new_const(
+            return Err(io::const_io_error!(
                 io::ErrorKind::InvalidInput,
-                &"cannot set a 0 duration timeout",
+                "cannot set a 0 duration timeout",
             ));
         }
 
@@ -165,7 +165,7 @@ impl Socket {
         loop {
             let elapsed = start.elapsed();
             if elapsed >= timeout {
-                return Err(io::Error::new_const(io::ErrorKind::TimedOut, &"connection timed out"));
+                return Err(io::const_io_error!(io::ErrorKind::TimedOut, "connection timed out"));
             }
 
             let timeout = timeout - elapsed;
@@ -192,9 +192,9 @@ impl Socket {
                     // for POLLHUP rather than read readiness
                     if pollfd.revents & libc::POLLHUP != 0 {
                         let e = self.take_error()?.unwrap_or_else(|| {
-                            io::Error::new_const(
+                            io::const_io_error!(
                                 io::ErrorKind::Uncategorized,
-                                &"no error set after POLLHUP",
+                                "no error set after POLLHUP",
                             )
                         });
                         return Err(e);
@@ -338,9 +338,9 @@ impl Socket {
         let timeout = match dur {
             Some(dur) => {
                 if dur.as_secs() == 0 && dur.subsec_nanos() == 0 {
-                    return Err(io::Error::new_const(
+                    return Err(io::const_io_error!(
                         io::ErrorKind::InvalidInput,
-                        &"cannot set a 0 duration timeout",
+                        "cannot set a 0 duration timeout",
                     ));
                 }