fuzz: Run cargo clippy

Unfortunately, cargo clippy fails when testing fuzz_seq_parse_number:

```
error[E0603]: module `number` is private
  --> fuzz_targets/fuzz_seq_parse_number.rs:9:13
   |
9  | use uu_seq::number::PreciseNumber;
   |             ^^^^^^ private module
   |
note: the module `number` is defined here
  --> /home/drinkcat/dev/coreutils/coreutils/src/uu/seq/src/seq.rs:24:1
   |
24 | mod number;
   | ^^^^^^^^^^
```

But we can still fix the rest...
This commit is contained in:
Nicolas Boichat 2025-04-08 17:38:33 +02:00
parent 75072b5a98
commit 2caeaf511e
2 changed files with 6 additions and 1 deletions

View file

@ -132,6 +132,8 @@ where
let (uumain_exit_status, captured_stdout, captured_stderr) = thread::scope(|s| {
let out = s.spawn(|| read_from_fd(pipe_stdout_fds[0]));
let err = s.spawn(|| read_from_fd(pipe_stderr_fds[0]));
#[allow(clippy::unnecessary_to_owned)]
// TODO: clippy wants us to use args.iter().cloned() ?
let status = uumain_function(args.to_owned().into_iter());
// Reset the exit code global variable in case we run another test after this one
// See https://github.com/uutils/coreutils/issues/5777
@ -409,6 +411,7 @@ pub fn generate_random_string(max_length: usize) -> String {
result
}
#[allow(dead_code)]
pub fn generate_random_file() -> Result<String, std::io::Error> {
let mut rng = rand::rng();
let file_name: String = (0..10)
@ -429,6 +432,7 @@ pub fn generate_random_file() -> Result<String, std::io::Error> {
Ok(file_path.to_str().unwrap().to_string())
}
#[allow(dead_code)]
pub fn replace_fuzz_binary_name(cmd: &str, result: &mut CommandResult) {
let fuzz_bin_name = format!("fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_{cmd}");

View file

@ -16,6 +16,7 @@ pub fn print_subsection<S: fmt::Display>(s: S) {
println!("{}", style(format!("--- {}", s)).bright());
}
#[allow(dead_code)]
pub fn print_test_begin<S: fmt::Display>(msg: S) {
println!(
"{} {} {}",
@ -50,7 +51,7 @@ pub fn print_with_style<S: fmt::Display>(msg: S, style: Style) {
println!("{}", style.apply_to(msg));
}
pub fn print_diff<'a, 'b>(got: &'a str, expected: &'b str) {
pub fn print_diff(got: &str, expected: &str) {
let diff = TextDiff::from_lines(got, expected);
print_subsection("START diff");