mirror of
https://github.com/uutils/findutils.git
synced 2026-06-10 15:48:30 -07:00
find: fix clippy::needless_for_each
This commit is contained in:
@@ -842,13 +842,11 @@ mod tests {
|
||||
// - find test_data/simple -cmin +1
|
||||
// - find test_data/simple -mmin +1
|
||||
// Means to find files accessed / modified more than 1 minute ago.
|
||||
[
|
||||
for time_type in &[
|
||||
FileTimeType::Accessed,
|
||||
FileTimeType::Changed,
|
||||
FileTimeType::Modified,
|
||||
]
|
||||
.iter()
|
||||
.for_each(|time_type| {
|
||||
] {
|
||||
let more_matcher =
|
||||
FileAgeRangeMatcher::new(*time_type, ComparableValue::MoreThan(1), true);
|
||||
assert!(
|
||||
@@ -863,7 +861,7 @@ mod tests {
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// less test
|
||||
// mocks:
|
||||
@@ -871,14 +869,12 @@ mod tests {
|
||||
// - find test_data/simple -cmin -1
|
||||
// - find test_data/simple -mmin -1
|
||||
// Means to find files accessed / modified less than 1 minute ago.
|
||||
[
|
||||
for time_type in &[
|
||||
FileTimeType::Accessed,
|
||||
#[cfg(unix)]
|
||||
FileTimeType::Changed,
|
||||
FileTimeType::Modified,
|
||||
]
|
||||
.iter()
|
||||
.for_each(|time_type| {
|
||||
] {
|
||||
let less_matcher =
|
||||
FileAgeRangeMatcher::new(*time_type, ComparableValue::LessThan(1), true);
|
||||
assert!(
|
||||
@@ -893,7 +889,7 @@ mod tests {
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// catch file error
|
||||
let _ = fs::remove_file(&*new_file.path().to_string_lossy());
|
||||
|
||||
+4
-4
@@ -1323,7 +1323,7 @@ mod tests {
|
||||
assert_eq!(rc, 1);
|
||||
|
||||
// test empty user name
|
||||
["-user", "-nouser"].iter().for_each(|&arg| {
|
||||
for &arg in &["-user", "-nouser"] {
|
||||
let deps = FakeDependencies::new();
|
||||
let rc = find_main(&["find", "./test_data/simple/subdir", arg, ""], &deps);
|
||||
|
||||
@@ -1333,7 +1333,7 @@ mod tests {
|
||||
let rc = find_main(&["find", "./test_data/simple/subdir", arg, " "], &deps);
|
||||
|
||||
assert_eq!(rc, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1411,7 +1411,7 @@ mod tests {
|
||||
assert_eq!(rc, 1);
|
||||
|
||||
// test empty user name and group name
|
||||
["-group", "-nogroup"].iter().for_each(|&arg| {
|
||||
for &arg in &["-group", "-nogroup"] {
|
||||
let deps = FakeDependencies::new();
|
||||
let rc = find_main(&["find", "./test_data/simple/subdir", arg, ""], &deps);
|
||||
|
||||
@@ -1421,7 +1421,7 @@ mod tests {
|
||||
let rc = find_main(&["find", "./test_data/simple/subdir", arg, " "], &deps);
|
||||
|
||||
assert_eq!(rc, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+6
-6
@@ -615,18 +615,18 @@ fn find_time() {
|
||||
"-ctime",
|
||||
"-mtime",
|
||||
];
|
||||
tests.iter().for_each(|flag| {
|
||||
args.iter().for_each(|arg| {
|
||||
for flag in &tests {
|
||||
for arg in &args {
|
||||
ucmd()
|
||||
.args(&["./test_data/simple", flag, arg])
|
||||
.succeeds()
|
||||
.no_stderr();
|
||||
});
|
||||
}
|
||||
|
||||
exception_args.iter().for_each(|arg| {
|
||||
for arg in &exception_args {
|
||||
ucmd().args(&[".", flag, arg]).fails().no_stdout();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user