summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-12-11 16:55:15 -0700
committerAlan Somers <asomers@gmail.com>2021-12-11 16:55:15 -0700
commite7e8abc506218d7772b610e9ba8ae29eed35314e (patch)
tree4fde4b5ded211e8bce919f0d7550f5b7aa897956
parentd9b69f9c6d8d2a47980d2dd9a9654e0b4f06b799 (diff)
downloadnix-e7e8abc506218d7772b610e9ba8ae29eed35314e.zip
clippy cleanup with the latest nightly
-rw-r--r--src/env.rs5
-rw-r--r--test/test_unistd.rs4
2 files changed, 4 insertions, 5 deletions
diff --git a/src/env.rs b/src/env.rs
index 54d75959..bcae2871 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -39,7 +39,6 @@ impl std::error::Error for ClearEnvError {}
/// environment access in the program is via `std::env`, but the requirement on
/// thread safety must still be upheld.
pub unsafe fn clearenv() -> std::result::Result<(), ClearEnvError> {
- let ret;
cfg_if! {
if #[cfg(any(target_os = "fuchsia",
target_os = "wasi",
@@ -48,13 +47,13 @@ pub unsafe fn clearenv() -> std::result::Result<(), ClearEnvError> {
target_os = "linux",
target_os = "android",
target_os = "emscripten"))] {
- ret = libc::clearenv();
+ let ret = libc::clearenv();
} else {
use std::env;
for (name, _) in env::vars_os() {
env::remove_var(name);
}
- ret = 0;
+ let ret = 0;
}
}
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index 3a1f9f10..61062ad2 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -154,7 +154,7 @@ fn test_mkfifoat_directory_none() {
let _m = crate::CWD_LOCK.read();
// mkfifoat should fail if a directory is given
- assert!(!mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_ok());
+ assert!(mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_err());
}
#[test]
@@ -168,7 +168,7 @@ fn test_mkfifoat_directory() {
let mkfifoat_dir = "mkfifoat_dir";
stat::mkdirat(dirfd, mkfifoat_dir, Mode::S_IRUSR).unwrap();
- assert!(!mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_ok());
+ assert!(mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_err());
}
#[test]