From 0bb179311dc3ccb54f7d54ed4e7b05c1d005ac4d Mon Sep 17 00:00:00 2001 From: Krysztal112233 Date: Thu, 21 Mar 2024 23:47:57 +0800 Subject: [PATCH] lint: fix `clippy::bool_assert_comparison` in `perms.rs` --- src/uucore/src/lib/features/perms.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 11bb0a8bb..ede61abc8 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -660,8 +660,8 @@ mod tests { assert_eq!(path.to_str(), Some("")); // The main point to test here is that we don't crash. // The result should be 'false', to avoid unnecessary and confusing warnings. - assert_eq!(false, is_root(&path, false)); - assert_eq!(false, is_root(&path, true)); + assert!(!is_root(&path, false)); + assert!(!is_root(&path, true)); } #[cfg(unix)] @@ -675,8 +675,8 @@ mod tests { "cfg(unix) but using non-unix path delimiters?!" ); // Must return true, this is the main scenario that --preserve-root shall prevent. - assert_eq!(true, is_root(&path, false)); - assert_eq!(true, is_root(&path, true)); + assert!(is_root(&path, false)); + assert!(is_root(&path, true)); } #[cfg(unix)] @@ -697,8 +697,8 @@ mod tests { // chown: it is dangerous to operate recursively on 'slink-to-root/' (same as '/') // chown: use --no-preserve-root to override this failsafe // [$? = 1] - assert_eq!(true, is_root(&symlink_path_slash, false)); - assert_eq!(true, is_root(&symlink_path_slash, true)); + assert!(is_root(&symlink_path_slash, false)); + assert!(is_root(&symlink_path_slash, true)); } #[cfg(unix)] @@ -709,7 +709,7 @@ mod tests { let symlink_path = temp_dir.path().join("symlink"); unix::fs::symlink(&PathBuf::from("/"), &symlink_path).unwrap(); // Only return true we're about to "accidentally" recurse on "/". - assert_eq!(false, is_root(&symlink_path, false)); - assert_eq!(true, is_root(&symlink_path, true)); + assert!(!is_root(&symlink_path, false)); + assert!(is_root(&symlink_path, true)); } }