diff options
Diffstat (limited to 'library/std/src/sys/unix/ext')
| -rw-r--r-- | library/std/src/sys/unix/ext/fs.rs | 6 | ||||
| -rw-r--r-- | library/std/src/sys/unix/ext/net/addr.rs | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/library/std/src/sys/unix/ext/fs.rs b/library/std/src/sys/unix/ext/fs.rs index 21bdfe29578..9a982a4acd9 100644 --- a/library/std/src/sys/unix/ext/fs.rs +++ b/library/std/src/sys/unix/ext/fs.rs @@ -109,7 +109,7 @@ pub trait FileExt { } } if !buf.is_empty() { - Err(io::Error::new(io::ErrorKind::UnexpectedEof, "failed to fill whole buffer")) + Err(io::Error::new_const(io::ErrorKind::UnexpectedEof, &"failed to fill whole buffer")) } else { Ok(()) } @@ -191,9 +191,9 @@ pub trait FileExt { while !buf.is_empty() { match self.write_at(buf, offset) { Ok(0) => { - return Err(io::Error::new( + return Err(io::Error::new_const( io::ErrorKind::WriteZero, - "failed to write whole buffer", + &"failed to write whole buffer", )); } Ok(n) => { diff --git a/library/std/src/sys/unix/ext/net/addr.rs b/library/std/src/sys/unix/ext/net/addr.rs index 1f9036242eb..6e7d1f1678a 100644 --- a/library/std/src/sys/unix/ext/net/addr.rs +++ b/library/std/src/sys/unix/ext/net/addr.rs @@ -29,16 +29,16 @@ pub(super) unsafe fn sockaddr_un(path: &Path) -> io::Result<(libc::sockaddr_un, let bytes = path.as_os_str().as_bytes(); if bytes.contains(&0) { - return Err(io::Error::new( + return Err(io::Error::new_const( io::ErrorKind::InvalidInput, - "paths may not contain interior null bytes", + &"paths may not contain interior null bytes", )); } if bytes.len() >= addr.sun_path.len() { - return Err(io::Error::new( + return Err(io::Error::new_const( io::ErrorKind::InvalidInput, - "path must be shorter than SUN_LEN", + &"path must be shorter than SUN_LEN", )); } for (dst, src) in addr.sun_path.iter_mut().zip(bytes.iter()) { @@ -118,9 +118,9 @@ impl SocketAddr { // linux returns zero bytes of address len = sun_path_offset(&addr) as libc::socklen_t; // i.e., zero-length address } else if addr.sun_family != libc::AF_UNIX as libc::sa_family_t { - return Err(io::Error::new( + return Err(io::Error::new_const( io::ErrorKind::InvalidInput, - "file descriptor did not correspond to a Unix socket", + &"file descriptor did not correspond to a Unix socket", )); } |
