diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index e83b6f697..ddebaae18 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -64,7 +64,7 @@ fn main() { // * prefix/stem may be any string ending in a non-alphanumeric character let util_name = if let Some(util) = utils.keys().find(|util| { binary_as_util.ends_with(*util) - && !(&binary_as_util[..binary_as_util.len() - (*util).len()]) + && !binary_as_util[..binary_as_util.len() - (*util).len()] .ends_with(char::is_alphanumeric) }) { // prefixed util => replace 0th (aka, executable name) argument diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 3f17124f8..4b113f880 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -479,7 +479,7 @@ fn write_lines( if !state.at_line_start || !options.squeeze_blank || !state.one_blank_kept { state.one_blank_kept = true; if state.at_line_start && options.number == NumberingMode::All { - write!(&mut writer, "{0:6}\t", state.line_number)?; + write!(writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } writer.write_all(options.end_of_line().as_bytes())?; @@ -498,7 +498,7 @@ fn write_lines( } state.one_blank_kept = false; if state.at_line_start && options.number != NumberingMode::None { - write!(&mut writer, "{0:6}\t", state.line_number)?; + write!(writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } diff --git a/src/uu/chcon/src/errors.rs b/src/uu/chcon/src/errors.rs index 2d8f72e67..8a1678a85 100644 --- a/src/uu/chcon/src/errors.rs +++ b/src/uu/chcon/src/errors.rs @@ -64,10 +64,10 @@ impl Error { pub(crate) fn report_full_error(mut err: &dyn std::error::Error) -> String { let mut desc = String::with_capacity(256); - write!(&mut desc, "{}", err).unwrap(); + write!(desc, "{}", err).unwrap(); while let Some(source) = err.source() { err = source; - write!(&mut desc, ". {}", err).unwrap(); + write!(desc, ". {}", err).unwrap(); } desc } diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index 492c8159f..f783c2d98 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -74,7 +74,7 @@ impl Sieve { #[allow(dead_code)] #[inline] pub fn odd_primes() -> PrimeSieve { - (&INIT_PRIMES[1..]).iter().copied().chain(Sieve::new()) + INIT_PRIMES[1..].iter().copied().chain(Sieve::new()) } } diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index df77c42f6..5fb75366d 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -132,7 +132,7 @@ fn check_basic(path: &[String]) -> bool { // path length if total_len > POSIX_PATH_MAX { writeln!( - &mut std::io::stderr(), + std::io::stderr(), "limit {} exceeded by length {} of file name {}", POSIX_PATH_MAX, total_len, @@ -140,7 +140,7 @@ fn check_basic(path: &[String]) -> bool { ); return false; } else if total_len == 0 { - writeln!(&mut std::io::stderr(), "empty file name"); + writeln!(std::io::stderr(), "empty file name"); return false; } // components: character portability and length @@ -148,7 +148,7 @@ fn check_basic(path: &[String]) -> bool { let component_len = p.len(); if component_len > POSIX_NAME_MAX { writeln!( - &mut std::io::stderr(), + std::io::stderr(), "limit {} exceeded by length {} of file name component {}", POSIX_NAME_MAX, component_len, @@ -170,7 +170,7 @@ fn check_extra(path: &[String]) -> bool { for p in path { if p.starts_with('-') { writeln!( - &mut std::io::stderr(), + std::io::stderr(), "leading hyphen in file name component {}", p.quote() ); @@ -179,7 +179,7 @@ fn check_extra(path: &[String]) -> bool { } // path length if path.join("/").is_empty() { - writeln!(&mut std::io::stderr(), "empty file name"); + writeln!(std::io::stderr(), "empty file name"); return false; } true @@ -192,7 +192,7 @@ fn check_default(path: &[String]) -> bool { // path length if total_len > libc::PATH_MAX as usize { writeln!( - &mut std::io::stderr(), + std::io::stderr(), "limit {} exceeded by length {} of file name {}", libc::PATH_MAX, total_len, @@ -205,7 +205,7 @@ fn check_default(path: &[String]) -> bool { let component_len = p.len(); if component_len > libc::FILENAME_MAX as usize { writeln!( - &mut std::io::stderr(), + std::io::stderr(), "limit {} exceeded by length {} of file name component {}", libc::FILENAME_MAX, component_len, @@ -227,7 +227,7 @@ fn check_searchable(path: &str) -> bool { if e.kind() == ErrorKind::NotFound { true } else { - writeln!(&mut std::io::stderr(), "{}", e); + writeln!(std::io::stderr(), "{}", e); false } } @@ -241,7 +241,7 @@ fn check_portable_chars(path_segment: &str) -> bool { if !VALID_CHARS.contains(ch) { let invalid = path_segment[i..].chars().next().unwrap(); writeln!( - &mut std::io::stderr(), + std::io::stderr(), "nonportable character '{}' in file name component {}", invalid, path_segment.quote() diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/float_common.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/float_common.rs index 97009b586..95b0e34e6 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/float_common.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/float_common.rs @@ -186,7 +186,7 @@ fn round_terminal_digit( if position < after_dec.len() { let digit_at_pos: char; { - digit_at_pos = (&after_dec[position..=position]).chars().next().expect(""); + digit_at_pos = after_dec[position..=position].chars().next().expect(""); } if let '5'..='9' = digit_at_pos { let (new_after_dec, finished_in_dec) = _round_str_from(&after_dec, position); diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index edb8066d6..dcdb2e9dc 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -205,13 +205,13 @@ fn test_single_big_args() { let mut big_input = at.make_file(FILE); for i in 0..LINES { - writeln!(&mut big_input, "Line {}", i).expect("Could not write to FILE"); + writeln!(big_input, "Line {}", i).expect("Could not write to FILE"); } big_input.flush().expect("Could not flush FILE"); let mut big_expected = at.make_file(EXPECTED_FILE); for i in (LINES - N_ARG)..LINES { - writeln!(&mut big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE"); + writeln!(big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE"); } big_expected.flush().expect("Could not flush EXPECTED_FILE"); @@ -254,14 +254,14 @@ fn test_bytes_big() { let mut big_input = at.make_file(FILE); for i in 0..BYTES { let digit = from_digit((i % 10) as u32, 10).unwrap(); - write!(&mut big_input, "{}", digit).expect("Could not write to FILE"); + write!(big_input, "{}", digit).expect("Could not write to FILE"); } big_input.flush().expect("Could not flush FILE"); let mut big_expected = at.make_file(EXPECTED_FILE); for i in (BYTES - N_ARG)..BYTES { let digit = from_digit((i % 10) as u32, 10).unwrap(); - write!(&mut big_expected, "{}", digit).expect("Could not write to EXPECTED_FILE"); + write!(big_expected, "{}", digit).expect("Could not write to EXPECTED_FILE"); } big_expected.flush().expect("Could not flush EXPECTED_FILE"); @@ -290,13 +290,13 @@ fn test_lines_with_size_suffix() { let mut big_input = at.make_file(FILE); for i in 0..LINES { - writeln!(&mut big_input, "Line {}", i).expect("Could not write to FILE"); + writeln!(big_input, "Line {}", i).expect("Could not write to FILE"); } big_input.flush().expect("Could not flush FILE"); let mut big_expected = at.make_file(EXPECTED_FILE); for i in (LINES - N_ARG)..LINES { - writeln!(&mut big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE"); + writeln!(big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE"); } big_expected.flush().expect("Could not flush EXPECTED_FILE");