diff options
-rw-r--r-- | src/mount/bsd.rs | 2 | ||||
-rw-r--r-- | src/sys/socket/addr.rs | 3 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 2 | ||||
-rw-r--r-- | test/test_fcntl.rs | 2 | ||||
-rw-r--r-- | test/test_sendfile.rs | 8 |
5 files changed, 10 insertions, 7 deletions
diff --git a/src/mount/bsd.rs b/src/mount/bsd.rs index dbff6541..6ed2dc7f 100644 --- a/src/mount/bsd.rs +++ b/src/mount/bsd.rs @@ -391,7 +391,7 @@ impl<'a> Nmount<'a> { }); let niov = self.iov.len() as c_uint; - let iovp = self.iov.as_mut_ptr() as *mut libc::iovec; + let iovp = self.iov.as_mut_ptr(); let res = unsafe { libc::nmount(iovp, niov, flags.bits()) }; match Errno::result(res) { Ok(_) => Ok(()), diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 2b3a1ed4..ff222b5e 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -484,6 +484,7 @@ enum UnixAddrKind<'a> { } impl<'a> UnixAddrKind<'a> { /// Safety: sun & sun_len must be valid + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms unsafe fn get(sun: &'a libc::sockaddr_un, sun_len: u8) -> Self { assert!(sun_len as usize >= offset_of!(libc::sockaddr_un, sun_path)); let path_len = @@ -520,6 +521,7 @@ impl<'a> UnixAddrKind<'a> { impl UnixAddr { /// Create a new sockaddr_un representing a filesystem path. + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms pub fn new<P: ?Sized + NixPath>(path: &P) -> Result<UnixAddr> { path.with_nix_path(|cstr| unsafe { let mut ret = libc::sockaddr_un { @@ -567,6 +569,7 @@ impl UnixAddr { /// processes to communicate with processes having a different filesystem view. #[cfg(any(target_os = "android", target_os = "linux"))] #[cfg_attr(docsrs, doc(cfg(all())))] + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms pub fn new_abstract(path: &[u8]) -> Result<UnixAddr> { unsafe { let mut ret = libc::sockaddr_un { diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 1e3438ea..c5a897c3 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -2234,7 +2234,7 @@ pub fn recvfrom<T: SockaddrLike>( Ok(( ret, T::from_raw( - addr.assume_init().as_ptr() as *const sockaddr, + addr.assume_init().as_ptr(), Some(len), ), )) diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index de502d1a..31df6d03 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -340,7 +340,7 @@ mod linux_android { let buf1 = b"abcdef"; let buf2 = b"defghi"; - let iovecs = vec![IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])]; + let iovecs = [IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])]; let res = vmsplice(wr, &iovecs[..], SpliceFFlags::empty()).unwrap(); diff --git a/test/test_sendfile.rs b/test/test_sendfile.rs index c6ac6e6f..b85e030f 100644 --- a/test/test_sendfile.rs +++ b/test/test_sendfile.rs @@ -72,10 +72,10 @@ fn test_sendfile64_linux() { fn test_sendfile_freebsd() { // Declare the content let header_strings = - vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; + ["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; let body = "Xabcdef123456"; let body_offset = 1; - let trailer_strings = vec!["\n", "Served by Make Believe\n"]; + let trailer_strings = ["\n", "Served by Make Believe\n"]; // Write the body to a file let mut tmp = tempfile().unwrap(); @@ -123,10 +123,10 @@ fn test_sendfile_freebsd() { fn test_sendfile_dragonfly() { // Declare the content let header_strings = - vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; + ["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; let body = "Xabcdef123456"; let body_offset = 1; - let trailer_strings = vec!["\n", "Served by Make Believe\n"]; + let trailer_strings = ["\n", "Served by Make Believe\n"]; // Write the body to a file let mut tmp = tempfile().unwrap(); |