summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-07-15 18:45:19 +0000
committerGitHub <noreply@github.com>2023-07-15 18:45:19 +0000
commitb12aeb723c753fb441bf4e9e67ac1276677ce0e5 (patch)
tree9ad6f0ece1af0455cc319d766b1499fbd98b1295
parent75a26cd1e0b44c8d953633ee45cfc189cda7e4d7 (diff)
parent45894112298e94af0a6040e2a6c155d8a9bef8ed (diff)
downloadnix-b12aeb723c753fb441bf4e9e67ac1276677ce0e5.zip
Merge #2076
2076: Clippy cleanup r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
-rw-r--r--src/mount/bsd.rs2
-rw-r--r--src/sys/socket/addr.rs3
-rw-r--r--src/sys/socket/mod.rs2
-rw-r--r--test/test_fcntl.rs2
-rw-r--r--test/test_sendfile.rs8
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();