From a8a43f73b0c4fcbada9ef08362987989774176d0 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 3 Apr 2025 14:24:16 +0200 Subject: [PATCH 1/4] clippy: fix errors from unnecessary_semicolon lint --- tests/by-util/test_cp.rs | 4 ++-- tests/by-util/test_factor.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 0d6526b47..cd4c16faf 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -5637,7 +5637,7 @@ mod link_deref { let mut args = vec!["--link", "-P", src, DST]; if r { args.push("-R"); - }; + } scene.ucmd().args(&args).succeeds().no_stderr(); at.is_symlink(DST); let src_ino = at.symlink_metadata(src).ino(); @@ -5658,7 +5658,7 @@ mod link_deref { let mut args = vec!["--link", DANG_LINK, DST]; if r { args.push("-R"); - }; + } if !option.is_empty() { args.push(option); } diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 2e86c82a7..0e8dca2cd 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -185,7 +185,7 @@ fn test_random() { factors.push(factor); } None => break, - }; + } } factors.sort_unstable(); From 59d7866dcf4d26e55a13f815db667afa9898248f Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 3 Apr 2025 14:25:51 +0200 Subject: [PATCH 2/4] uutests: fix clippy errors from doc_overindented_list_items lint --- tests/uutests/src/lib/util.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/uutests/src/lib/util.rs b/tests/uutests/src/lib/util.rs index bef500f5c..4579b564d 100644 --- a/tests/uutests/src/lib/util.rs +++ b/tests/uutests/src/lib/util.rs @@ -1374,9 +1374,9 @@ pub struct TerminalSimulation { /// A `UCommand` is a builder wrapping an individual Command that provides several additional features: /// 1. it has convenience functions that are more ergonomic to use for piping in stdin, spawning the command -/// and asserting on the results. +/// and asserting on the results. /// 2. it tracks arguments provided so that in test cases which may provide variations of an arg in loops -/// the test failure can display the exact call which preceded an assertion failure. +/// the test failure can display the exact call which preceded an assertion failure. /// 3. it provides convenience construction methods to set the Command uutils utility and temporary directory. /// /// Per default `UCommand` runs a command given as an argument in a shell, platform independently. From 5ab49687212c28d018581a45e0fc43807824e7b0 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 3 Apr 2025 14:27:43 +0200 Subject: [PATCH 3/4] dd: fix "unused import" warning in test --- tests/by-util/test_dd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_dd.rs b/tests/by-util/test_dd.rs index e46015b55..8c0f617f8 100644 --- a/tests/by-util/test_dd.rs +++ b/tests/by-util/test_dd.rs @@ -7,7 +7,7 @@ use uutests::at_and_ucmd; use uutests::new_ucmd; use uutests::util::TestScenario; -#[cfg(unix)] +#[cfg(all(unix, not(feature = "feat_selinux")))] use uutests::util::run_ucmd_as_root_with_stdin_stdout; #[cfg(all(not(windows), feature = "printf"))] use uutests::util::{UCommand, get_tests_binary}; From 293554e3586ebd53c18865093e1962b1d2155aed Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 3 Apr 2025 15:38:06 +0200 Subject: [PATCH 4/4] yes: fix error from manual_repeat_n lint --- src/uu/yes/src/yes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index d9bbc64e4..a9229630e 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -157,7 +157,7 @@ mod tests { ]; for (line, final_len) in tests { - let mut v = std::iter::repeat(b'a').take(line).collect::>(); + let mut v = std::iter::repeat_n(b'a', line).collect::>(); prepare_buffer(&mut v); assert_eq!(v.len(), final_len); }