diff options
-rw-r--r-- | .cirrus.yml | 4 | ||||
-rw-r--r-- | test/sys/test_pthread.rs | 2 | ||||
-rw-r--r-- | test/sys/test_socket.rs | 14 | ||||
-rw-r--r-- | test/test_unistd.rs | 5 |
4 files changed, 11 insertions, 14 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 1da767a6..9b735cf2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -20,7 +20,7 @@ build: &BUILD - rustc +$TOOLCHAIN -Vv - $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets - $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET - - $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET -- -D warnings + - $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET --all-targets -- -D warnings - if [ -z "$NOHACK" ]; then $TOOL +$TOOLCHAIN install cargo-hack; fi - if [ -z "$NOHACK" ]; then $TOOL +$TOOLCHAIN hack $ZFLAGS check --target $TARGET --each-feature; fi @@ -327,4 +327,4 @@ task: container: image: rust:latest setup_script: rustup +$TOOLCHAIN component add rustfmt - test_script: $TOOL +$TOOLCHAIN fmt --all -- --check
\ No newline at end of file + test_script: $TOOL +$TOOLCHAIN fmt --all -- --check diff --git a/test/sys/test_pthread.rs b/test/sys/test_pthread.rs index fa9b510e..42a4aefa 100644 --- a/test/sys/test_pthread.rs +++ b/test/sys/test_pthread.rs @@ -4,7 +4,7 @@ use nix::sys::pthread::*; #[test] fn test_pthread_self() { let tid = pthread_self(); - assert!(tid != ::std::ptr::null_mut()); + assert!(!tid.is_null()); } #[cfg(not(any(target_env = "musl", target_os = "redox")))] diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 067717bb..3a553d3a 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -345,7 +345,7 @@ mod recvfrom { ) .unwrap(); // Ignore from for stream sockets - let _ = sendrecv(fd1, fd2, |s, m, flags| send(s, m, flags), |_, _| {}); + let _ = sendrecv(fd1, fd2, send, |_, _| {}); } #[test] @@ -1472,7 +1472,7 @@ fn loopback_address( use std::io; use std::io::Write; - let addrs = match getifaddrs() { + let mut addrs = match getifaddrs() { Ok(iter) => iter, Err(e) => { let stdioerr = io::stderr(); @@ -1482,15 +1482,11 @@ fn loopback_address( } }; // return first address matching family - for ifaddr in addrs { - if ifaddr.flags.contains(InterfaceFlags::IFF_LOOPBACK) + addrs.find(|ifaddr| { + ifaddr.flags.contains(InterfaceFlags::IFF_LOOPBACK) && ifaddr.address.as_ref().and_then(SockaddrLike::family) == Some(family) - { - return Some(ifaddr); - } - } - None + }) } #[cfg(any( diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 23392834..38d31a3f 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -1169,6 +1169,8 @@ fn test_access_file_exists() { assert!(access(&path, AccessFlags::R_OK | AccessFlags::W_OK).is_ok()); } +//Clippy false positive https://github.com/rust-lang/rust-clippy/issues/9111 +#[allow(clippy::needless_borrow)] #[cfg(not(target_os = "redox"))] #[test] fn test_user_into_passwd() { @@ -1198,8 +1200,7 @@ fn test_setfsuid() { // create a temporary file with permissions '-rw-r-----' let file = tempfile::NamedTempFile::new_in("/var/tmp").unwrap(); let temp_path = file.into_temp_path(); - dbg!(&temp_path); - let temp_path_2 = (&temp_path).to_path_buf(); + let temp_path_2 = temp_path.to_path_buf(); let mut permissions = fs::metadata(&temp_path).unwrap().permissions(); permissions.set_mode(0o640); |