1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

lint: fix clippy::bool_assert_comparison in perms.rs

This commit is contained in:
Krysztal112233 2024-03-21 23:47:57 +08:00
parent 63d92cdbda
commit 0bb179311d
No known key found for this signature in database
GPG key ID: 331615739A596A02

View file

@ -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));
}
}