1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Clippy fixes

This commit is contained in:
Jeffrey Finkelstein 2023-02-13 21:33:42 -05:00
parent 072335a2ff
commit c6d9d7f11c
3 changed files with 3 additions and 10 deletions

View file

@ -347,7 +347,7 @@ impl<'a, 'b> MDWriter<'a, 'b> {
.trim() .trim()
.to_string(); .to_string();
if result != "" { if !result.is_empty() {
Some(result) Some(result)
} else { } else {
None None

View file

@ -417,7 +417,6 @@ fn test_with_pr_core_utils_tests() {
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
let mut arguments: Vec<&str> = flags let mut arguments: Vec<&str> = flags
.split(' ') .split(' ')
.into_iter()
.filter(|i| i.trim() != "") .filter(|i| i.trim() != "")
.collect::<Vec<&str>>(); .collect::<Vec<&str>>();

View file

@ -174,17 +174,12 @@ fn test_verbose_nested_failure() {
#[cfg(unix)] #[cfg(unix)]
#[test] #[test]
fn test_rmdir_ignore_nonempty_no_permissions() { fn test_rmdir_ignore_nonempty_no_permissions() {
use std::fs;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
// We make the *parent* dir read-only to prevent deleting the dir in it. // We make the *parent* dir read-only to prevent deleting the dir in it.
at.mkdir_all("dir/ect/ory"); at.mkdir_all("dir/ect/ory");
at.touch("dir/ect/ory/file"); at.touch("dir/ect/ory/file");
let dir_ect = at.plus("dir/ect"); at.set_mode("dir/ect", 0o555);
let mut perms = fs::metadata(&dir_ect).unwrap().permissions();
perms.set_readonly(true);
fs::set_permissions(&dir_ect, perms.clone()).unwrap();
// rmdir should now get a permissions error that it interprets as // rmdir should now get a permissions error that it interprets as
// a non-empty error. // a non-empty error.
@ -196,8 +191,7 @@ fn test_rmdir_ignore_nonempty_no_permissions() {
assert!(at.dir_exists("dir/ect/ory")); assert!(at.dir_exists("dir/ect/ory"));
// Politely restore permissions for cleanup // Politely restore permissions for cleanup
perms.set_readonly(false); at.set_mode("dir/ect", 0o755);
fs::set_permissions(&dir_ect, perms).unwrap();
} }
#[test] #[test]