From 784f2e2ea1f7e8adde2796ce214a1927e609308d Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 30 Jan 2022 13:55:03 +0100 Subject: [PATCH] use semicolons if nothing returned --- build.rs | 10 ++++---- src/bin/uudoc.rs | 2 +- src/uu/chcon/src/chcon.rs | 2 +- src/uu/cp/src/cp.rs | 6 ++--- src/uu/dd/src/parseargs.rs | 4 ++-- src/uu/dd/src/parseargs/unit_tests.rs | 4 ++-- src/uu/dircolors/src/dircolors.rs | 4 ++-- src/uu/dirname/src/dirname.rs | 2 +- src/uu/du/src/du.rs | 4 ++-- src/uu/expand/src/expand.rs | 2 +- src/uu/expr/src/syntax_tree.rs | 2 +- src/uu/expr/src/tokens.rs | 4 ++-- src/uu/factor/src/factor.rs | 8 +++---- src/uu/fmt/src/linebreak.rs | 2 +- src/uu/hashsum/src/digest.rs | 2 +- src/uu/hashsum/src/hashsum.rs | 24 +++++++++---------- src/uu/head/src/head.rs | 4 ++-- src/uu/head/src/parse.rs | 12 +++++----- src/uu/ln/src/ln.rs | 6 ++--- src/uu/mktemp/src/mktemp.rs | 2 +- src/uu/mv/src/mv.rs | 4 ++-- src/uu/od/src/multifilereader.rs | 2 +- src/uu/od/src/parse_formats.rs | 2 +- src/uu/pinky/src/pinky.rs | 14 +++++------ src/uu/ptx/src/ptx.rs | 2 +- src/uu/shred/src/shred.rs | 4 ++-- src/uu/shuf/src/rand_read_adapter.rs | 2 +- src/uu/sort/src/ext_sort.rs | 2 +- src/uu/sort/src/merge.rs | 4 ++-- src/uu/sort/src/sort.rs | 12 +++++----- src/uu/split/src/platform/unix.rs | 2 +- src/uu/stat/src/stat.rs | 2 +- src/uu/tail/src/parse.rs | 12 +++++----- src/uu/tail/src/tail.rs | 2 +- src/uu/tee/src/tee.rs | 2 +- src/uu/uptime/src/uptime.rs | 2 +- src/uu/wc/src/word_count.rs | 2 +- src/uu/who/src/who.rs | 2 +- src/uucore/src/lib/features/fs.rs | 2 +- src/uucore/src/lib/features/fsext.rs | 2 +- src/uucore/src/lib/features/mode.rs | 4 ++-- src/uucore/src/lib/features/perms.rs | 6 ++--- .../num_format/formatters/base_conv/mod.rs | 6 ++--- src/uucore/src/lib/features/tokenize/sub.rs | 4 ++-- .../lib/features/tokenize/unescaped_text.rs | 2 +- src/uucore/src/lib/lib.rs | 2 +- src/uucore/src/lib/mods/panic.rs | 2 +- tests/by-util/test_chcon.rs | 4 ++-- tests/by-util/test_chown.rs | 2 +- tests/by-util/test_env.rs | 2 +- tests/by-util/test_ls.rs | 4 ++-- tests/by-util/test_mkdir.rs | 6 ++--- tests/by-util/test_shuf.rs | 4 ++-- tests/by-util/test_sort.rs | 10 ++++---- tests/by-util/test_touch.rs | 2 +- tests/common/util.rs | 8 +++---- 56 files changed, 125 insertions(+), 127 deletions(-) diff --git a/build.rs b/build.rs index ecff0f707..a5dfb3646 100644 --- a/build.rs +++ b/build.rs @@ -77,7 +77,7 @@ pub fn main() { ) .as_bytes(), ) - .unwrap() + .unwrap(); } k if k.starts_with(override_prefix) => { mf.write_all( @@ -97,7 +97,7 @@ pub fn main() { ) .as_bytes(), ) - .unwrap() + .unwrap(); } "false" | "true" => { mf.write_all( @@ -116,7 +116,7 @@ pub fn main() { ) .as_bytes(), ) - .unwrap() + .unwrap(); } "hashsum" => { mf.write_all( @@ -150,7 +150,7 @@ pub fn main() { ) .as_bytes(), ) - .unwrap() + .unwrap(); } _ => { mf.write_all( @@ -169,7 +169,7 @@ pub fn main() { ) .as_bytes(), ) - .unwrap() + .unwrap(); } } } diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index 38e8a0323..bbb20eb1d 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -45,7 +45,7 @@ fn main() -> io::Result<()> { } else { println!("Error writing to {}", p); } - writeln!(summary, "* [{0}](utils/{0}.md)", name)? + writeln!(summary, "* [{0}](utils/{0}.md)", name)?; } Ok(()) } diff --git a/src/uu/chcon/src/chcon.rs b/src/uu/chcon/src/chcon.rs index 0b373c5e0..84de681cd 100644 --- a/src/uu/chcon/src/chcon.rs +++ b/src/uu/chcon/src/chcon.rs @@ -743,7 +743,7 @@ This almost certainly means that you have a corrupted file system.\n\ NOTIFY YOUR SYSTEM MANAGER.\n\ The following directory is part of the cycle {}.", file_name.quote() - ) + ); } #[derive(Debug)] diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index a0d62295e..49cecfc00 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -742,7 +742,7 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec CopyResu } _ => { show_error!("{}", error); - non_fatal_errors = true + non_fatal_errors = true; } } } @@ -1580,5 +1580,5 @@ fn test_cp_localize_to_target() { ) .unwrap() == Path::new("target/c.txt") - ) + ); } diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index 57d93f966..c790de41f 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -491,14 +491,14 @@ pub fn parse_conv_flag_input(matches: &Matches) -> Result { if case.is_some() { return Err(ParseError::MultipleUCaseLCase); } else { - case = Some(flag) + case = Some(flag); } } ConvFlag::Block => match (cbs, iconvflags.unblock) { diff --git a/src/uu/dd/src/parseargs/unit_tests.rs b/src/uu/dd/src/parseargs/unit_tests.rs index c74439159..a72944309 100644 --- a/src/uu/dd/src/parseargs/unit_tests.rs +++ b/src/uu/dd/src/parseargs/unit_tests.rs @@ -56,10 +56,10 @@ fn unimplemented_flags_should_error() { let matches = uu_app().try_get_matches_from(args).unwrap(); if parse_iflags(&matches).is_ok() { - succeeded.push(format!("iflag={}", flag)) + succeeded.push(format!("iflag={}", flag)); } if parse_oflags(&matches).is_ok() { - succeeded.push(format!("oflag={}", flag)) + succeeded.push(format!("oflag={}", flag)); } } diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 2fee24e5b..56f7e62de 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -127,7 +127,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let result; if files.is_empty() { - result = parse(INTERNAL_DB.lines(), &out_format, "") + result = parse(INTERNAL_DB.lines(), &out_format, ""); } else { if files.len() > 1 { return Err(UUsageError::new( @@ -138,7 +138,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match File::open(files[0]) { Ok(f) => { let fin = BufReader::new(f); - result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]) + result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]); } Err(e) => { return Err(USimpleError::new( diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 4a6a5ad9b..343007d29 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -61,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match p.parent() { Some(d) => { if d.components().next() == None { - print!(".") + print!("."); } else { print_verbatim(d).unwrap(); } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 71d335b1e..e95541cac 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -335,7 +335,7 @@ fn du( ErrorKind::PermissionDenied => { let description = format!("cannot access {}", entry.path().quote()); let error_message = "Permission denied"; - show_error_custom_description!(description, "{}", error_message) + show_error_custom_description!(description, "{}", error_message); } _ => show_error!("cannot access {}: {}", entry.path().quote(), error), }, @@ -486,7 +486,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if options.inodes && (matches.is_present(options::APPARENT_SIZE) || matches.is_present(options::BYTES)) { - show_warning!("options --apparent-size and -b are ineffective with --inodes") + show_warning!("options --apparent-size and -b are ineffective with --inodes"); } let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap(); diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 429bc1cc7..ebddaa690 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -332,7 +332,7 @@ fn expand(options: &Options) -> std::io::Result<()> { // now dump out either spaces if we're expanding, or a literal tab if we're not if init || !options.iflag { if nts <= options.tspaces.len() { - output.write_all(options.tspaces[..nts].as_bytes())? + output.write_all(options.tspaces[..nts].as_bytes())?; } else { output.write_all(" ".repeat(nts).as_bytes())?; }; diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index dd90fd0aa..3c78358dc 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -370,7 +370,7 @@ fn push_op_to_stack( }, )) => { if la && prev_prec >= prec || !la && prev_prec > prec { - out_stack.push(op_stack.pop().unwrap()) + out_stack.push(op_stack.pop().unwrap()); } else { op_stack.push((token_idx, token.clone())); return Ok(()); diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index 748960bc3..a80ad4a60 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -155,8 +155,8 @@ fn push_token_if_not_escaped(acc: &mut Vec<(usize, Token)>, tok_idx: usize, toke if should_use_as_escaped { acc.pop(); - acc.push((tok_idx, Token::new_value(s))) + acc.push((tok_idx, Token::new_value(s))); } else { - acc.push((tok_idx, token)) + acc.push((tok_idx, token)); } } diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index d5dbf2491..151aa74a9 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -34,7 +34,7 @@ impl Decomposition { if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) { *e += exp; } else { - self.0.push((factor, exp)) + self.0.push((factor, exp)); } } @@ -79,11 +79,11 @@ impl Factors { pub fn add(&mut self, prime: u64, exp: Exponent) { debug_assert!(miller_rabin::is_prime(prime)); - self.0.borrow_mut().add(prime, exp) + self.0.borrow_mut().add(prime, exp); } pub fn push(&mut self, prime: u64) { - self.add(prime, 1) + self.add(prime, 1); } #[cfg(test)] @@ -99,7 +99,7 @@ impl fmt::Display for Factors { for (p, exp) in v.iter() { for _ in 0..*exp { - write!(f, " {}", p)? + write!(f, " {}", p)?; } } diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index d24d92798..f3096d279 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -384,7 +384,7 @@ fn build_best_path<'a>(paths: &[LineBreak<'a>], active: &[usize]) -> Vec<(&'a Wo None => return breakwords, Some(prev) => { breakwords.push((prev, next_best.break_before)); - best_idx = next_best.prev + best_idx = next_best.prev; } } } diff --git a/src/uu/hashsum/src/digest.rs b/src/uu/hashsum/src/digest.rs index 61f425662..4b6b5f6d2 100644 --- a/src/uu/hashsum/src/digest.rs +++ b/src/uu/hashsum/src/digest.rs @@ -44,7 +44,7 @@ impl Digest for md5::Context { } fn input(&mut self, input: &[u8]) { - self.consume(input) + self.consume(input); } fn result(&mut self, out: &mut [u8]) { diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 82f485875..30c9d5b92 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -173,28 +173,28 @@ fn detect_algo( }; name = n; alg = Some(val); - output_bits = bits + output_bits = bits; }; if matches.is_present("md5") { - set_or_crash("MD5", Box::new(Md5::new()), 128) + set_or_crash("MD5", Box::new(Md5::new()), 128); } if matches.is_present("sha1") { - set_or_crash("SHA1", Box::new(Sha1::new()), 160) + set_or_crash("SHA1", Box::new(Sha1::new()), 160); } if matches.is_present("sha224") { - set_or_crash("SHA224", Box::new(Sha224::new()), 224) + set_or_crash("SHA224", Box::new(Sha224::new()), 224); } if matches.is_present("sha256") { - set_or_crash("SHA256", Box::new(Sha256::new()), 256) + set_or_crash("SHA256", Box::new(Sha256::new()), 256); } if matches.is_present("sha384") { - set_or_crash("SHA384", Box::new(Sha384::new()), 384) + set_or_crash("SHA384", Box::new(Sha384::new()), 384); } if matches.is_present("sha512") { - set_or_crash("SHA512", Box::new(Sha512::new()), 512) + set_or_crash("SHA512", Box::new(Sha512::new()), 512); } if matches.is_present("b2sum") { - set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512) + set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512); } if matches.is_present("sha3") { match matches.value_of("bits") { @@ -229,16 +229,16 @@ fn detect_algo( } } if matches.is_present("sha3-224") { - set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224) + set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224); } if matches.is_present("sha3-256") { - set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256) + set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256); } if matches.is_present("sha3-384") { - set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384) + set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384); } if matches.is_present("sha3-512") { - set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512) + set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512); } if matches.is_present("shake128") { match matches.value_of("bits") { diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 5c222657b..69c1ed100 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -424,7 +424,7 @@ fn uu_head(options: &HeadOptions) -> UResult<()> { if !first { println!(); } - println!("==> standard input <==") + println!("==> standard input <=="); } let stdin = std::io::stdin(); let mut stdin = stdin.lock(); @@ -460,7 +460,7 @@ fn uu_head(options: &HeadOptions) -> UResult<()> { if !first { println!(); } - println!("==> {} <==", name) + println!("==> {} <==", name); } head_file(&mut file, options) } diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 8bcfea3da..3f1d8ef42 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -43,11 +43,11 @@ pub fn parse_obsolete(src: &str) -> Option // this also saves us 1 heap allocation 'q' => { quiet = true; - verbose = false + verbose = false; } 'v' => { verbose = true; - quiet = false + quiet = false; } 'z' => zero_terminated = true, 'c' => multiplier = Some(1), @@ -58,20 +58,20 @@ pub fn parse_obsolete(src: &str) -> Option _ => return Some(Err(ParseError::Syntax)), } if let Some((_, next)) = chars.next() { - c = next + c = next; } else { break; } } let mut options = Vec::new(); if quiet { - options.push(OsString::from("-q")) + options.push(OsString::from("-q")); } if verbose { - options.push(OsString::from("-v")) + options.push(OsString::from("-v")); } if zero_terminated { - options.push(OsString::from("-z")) + options.push(OsString::from("-z")); } if let Some(n) = multiplier { options.push(OsString::from("-c")); diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index cd2dde5fd..ff9a34d43 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -308,7 +308,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) if is_symlink(target_dir) { if target_dir.is_file() { if let Err(e) = fs::remove_file(target_dir) { - show_error!("Could not update {}: {}", target_dir.quote(), e) + show_error!("Could not update {}: {}", target_dir.quote(), e); }; } if target_dir.is_dir() { @@ -316,7 +316,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) // considered as a dir // See test_ln::test_symlink_no_deref_dir if let Err(e) = fs::remove_dir(target_dir) { - show_error!("Could not update {}: {}", target_dir.quote(), e) + show_error!("Could not update {}: {}", target_dir.quote(), e); }; } } @@ -402,7 +402,7 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> { if !read_yes() { return Ok(()); } - fs::remove_file(dst)? + fs::remove_file(dst)?; } OverwriteMode::Force => fs::remove_file(dst)?, }; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 83a567c4b..687915640 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -118,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } if matches.is_present(OPT_T) { - tmpdir = env::temp_dir() + tmpdir = env::temp_dir(); } let res = if dry_run { diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 9c672782b..ee77b63f4 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -305,7 +305,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR sourcepath.quote(), targetpath.quote() )) - ) + ); } Ok(()) } @@ -340,7 +340,7 @@ fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> { // normalize behavior between *nix and windows if from.is_dir() { if is_empty_dir(to) { - fs::remove_dir(to)? + fs::remove_dir(to)?; } else { return Err(io::Error::new(io::ErrorKind::Other, "Directory not empty")); } diff --git a/src/uu/od/src/multifilereader.rs b/src/uu/od/src/multifilereader.rs index 1b3aba03d..7fbd75358 100644 --- a/src/uu/od/src/multifilereader.rs +++ b/src/uu/od/src/multifilereader.rs @@ -60,7 +60,7 @@ impl<'b> MultifileReader<'b> { // then move on the the next file. // This matches the behavior of the original `od` show_error!("{}: {}", fname.maybe_quote(), e); - self.any_err = true + self.any_err = true; } } } diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index 301bb5154..01dd65e1c 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -138,7 +138,7 @@ pub fn parse_format_flags(args: &[String]) -> Result std::io::Result RngCore for ReadRng { panic!( "reading random bytes from Read implementation failed; error: {}", err - ) + ); }); } diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 4bef20625..fbb9c16d7 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -159,7 +159,7 @@ fn reader_writer< fn sorter(receiver: &Receiver, sender: &SyncSender, settings: &GlobalSettings) { while let Ok(mut payload) = receiver.recv() { payload.with_contents_mut(|contents| { - sort_by(&mut contents.lines, settings, &contents.line_data) + sort_by(&mut contents.lines, settings, &contents.line_data); }); if sender.send(payload).is_err() { // The receiver has gone away, likely because the other thread hit an error. diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 8350cdf30..96d5128f6 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -50,7 +50,7 @@ fn replace_output_file_in_input_files( std::fs::copy(file_path, ©_path) .map_err(|error| SortError::OpenTmpFileFailed { error })?; *file = copy_path.clone().into_os_string(); - copy = Some(copy_path) + copy = Some(copy_path); } } } @@ -187,7 +187,7 @@ fn merge_without_limit>>( file_number, line_idx: 0, receiver, - }) + }); } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index e7d7bb03f..239256aae 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -535,7 +535,7 @@ impl<'a> Line<'a> { } Selection::Str(str) => { if selector.needs_selection { - line_data.selections.push(str) + line_data.selections.push(str); } } } @@ -701,9 +701,9 @@ impl<'a> Line<'a> { fn tokenize(line: &str, separator: Option, token_buffer: &mut Vec) { assert!(token_buffer.is_empty()); if let Some(separator) = separator { - tokenize_with_separator(line, separator, token_buffer) + tokenize_with_separator(line, separator, token_buffer); } else { - tokenize_default(line, token_buffer) + tokenize_default(line, token_buffer); } } @@ -1232,7 +1232,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { ), )); } - settings.separator = Some(separator.chars().next().unwrap()) + settings.separator = Some(separator.chars().next().unwrap()); } if let Some(values) = matches.values_of(options::KEY) { @@ -1524,9 +1524,9 @@ fn exec( fn sort_by<'a>(unsorted: &mut Vec>, settings: &GlobalSettings, line_data: &LineData<'a>) { if settings.stable || settings.unique { - unsorted.par_sort_by(|a, b| compare_by(a, b, settings, line_data, line_data)) + unsorted.par_sort_by(|a, b| compare_by(a, b, settings, line_data, line_data)); } else { - unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings, line_data, line_data)) + unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings, line_data, line_data)); } } diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index 448b8b782..c05593861 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -55,7 +55,7 @@ impl Drop for WithEnvVarSet { if let Ok(ref prev_value) = self._previous_var_value { env::set_var(&self._previous_var_key, &prev_value); } else { - env::remove_var(&self._previous_var_key) + env::remove_var(&self._previous_var_key); } } } diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 11f8581be..fd8578faa 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -406,7 +406,7 @@ impl Stater { flag, precision, format: chars[i], - }) + }); } '\\' => { if !use_printf { diff --git a/src/uu/tail/src/parse.rs b/src/uu/tail/src/parse.rs index a788b2c48..1c4f36bbd 100644 --- a/src/uu/tail/src/parse.rs +++ b/src/uu/tail/src/parse.rs @@ -42,11 +42,11 @@ pub fn parse_obsolete(src: &str) -> Option // this also saves us 1 heap allocation 'q' => { quiet = true; - verbose = false + verbose = false; } 'v' => { verbose = true; - quiet = false + quiet = false; } 'z' => zero_terminated = true, 'c' => multiplier = Some(1), @@ -57,20 +57,20 @@ pub fn parse_obsolete(src: &str) -> Option _ => return Some(Err(ParseError::Syntax)), } if let Some((_, next)) = chars.next() { - c = next + c = next; } else { break; } } let mut options = Vec::new(); if quiet { - options.push(OsString::from("-q")) + options.push(OsString::from("-q")); } if verbose { - options.push(OsString::from("-v")) + options.push(OsString::from("-v")); } if zero_terminated { - options.push(OsString::from("-z")) + options.push(OsString::from("-z")); } if let Some(n) = multiplier { options.push(OsString::from("-c")); diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 7c2652a7b..54808ed34 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -102,7 +102,7 @@ impl Settings { if let Some(n) = matches.value_of(options::SLEEP_INT) { let parsed: Option = n.parse().ok(); if let Some(m) = parsed { - settings.sleep_msec = m * 1000 + settings.sleep_msec = m * 1000; } } } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 937f06769..8285ac60b 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -97,7 +97,7 @@ fn ignore_interrupts() -> Result<()> { fn tee(options: &Options) -> Result<()> { if options.ignore_interrupts { - ignore_interrupts()? + ignore_interrupts()?; } let mut writers: Vec = options .files diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index a9d971e5b..13ec7fd23 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -178,7 +178,7 @@ fn print_uptime(upsecs: i64) { match updays.cmp(&1) { std::cmp::Ordering::Equal => print!("up {:1} day, {:2}:{:02}, ", updays, uphours, upmins), std::cmp::Ordering::Greater => { - print!("up {:1} days, {:2}:{:02}, ", updays, uphours, upmins) + print!("up {:1} days, {:2}:{:02}, ", updays, uphours, upmins); } _ => print!("up {:2}:{:02}, ", uphours, upmins), }; diff --git a/src/uu/wc/src/word_count.rs b/src/uu/wc/src/word_count.rs index 617b811fc..c1dd0c3d3 100644 --- a/src/uu/wc/src/word_count.rs +++ b/src/uu/wc/src/word_count.rs @@ -27,7 +27,7 @@ impl Add for WordCount { impl AddAssign for WordCount { fn add_assign(&mut self, other: Self) { - *self = *self + other + *self = *self + other; } } diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 8df10b745..50dde9de0 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -351,7 +351,7 @@ impl Who { let records = Utmpx::iter_all_records_from(f).peekable(); if self.include_heading { - self.print_heading() + self.print_heading(); } let cur_tty = if self.my_line_only { current_tty() diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 680f0f72b..b1b86e73a 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -159,7 +159,7 @@ pub fn resolve_relative_path(path: &Path) -> Cow { } Component::CurDir => (), Component::RootDir | Component::Normal(_) | Component::Prefix(_) => { - result.push(comp.as_os_str()) + result.push(comp.as_os_str()); } } } diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index b3ea7e780..8ba7f8fc0 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -156,7 +156,7 @@ impl MountInfo { // but set dev_id if let Ok(stat) = std::fs::metadata(&self.mount_dir) { // Why do we cast this to i32? - self.dev_id = (stat.dev() as i32).to_string() + self.dev_id = (stat.dev() as i32).to_string(); } else { self.dev_id = "".to_string(); } diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 2206177a3..bf11e481a 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -62,7 +62,7 @@ pub fn parse_symbolic( // keep the setgid and setuid bits for directories srwx |= fperm & (0o4000 | 0o2000); } - fperm = (fperm & !mask) | (srwx & mask) + fperm = (fperm & !mask) | (srwx & mask); } _ => unreachable!(), } @@ -113,7 +113,7 @@ fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { 'x' => srwx |= 0o111, 'X' => { if considering_dir || (fperm & 0o0111) != 0 { - srwx |= 0o111 + srwx |= 0o111; } } 's' => srwx |= 0o4000 | 0o2000, diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 128334f1c..942c67e29 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -296,9 +296,9 @@ impl ChownExecutor { } else { "Too many levels of symbolic links".into() } - ) + ); } else { - show_error!("{}", e) + show_error!("{}", e); } continue; } @@ -450,7 +450,7 @@ pub fn chown_base<'a>( .required(true) .takes_value(true) .multiple_occurrences(false), - ) + ); } app = app.arg( Arg::new(options::ARG_FILES) diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs index d92caff75..e6b1ea770 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs @@ -16,7 +16,7 @@ pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Ve new_amount = (u16::from(*u) * fact) + carry; rem = new_amount % base; carry = (new_amount - rem) / base; - ret_rev.push(rem as u8) + ret_rev.push(rem as u8); } None => { while carry != 0 { @@ -119,7 +119,7 @@ pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec< new_amount = u16::from(*u) + carry; rem = new_amount % base; carry = (new_amount - rem) / base; - ret_rev.push(rem as u8) + ret_rev.push(rem as u8); } None => { while carry != 0 { @@ -170,7 +170,7 @@ pub fn base_conv_float(src: &[u8], radix_src: u8, _radix_dest: u8) -> f64 { break; } factor /= radix_src_float; - r += factor * f64::from(*u) + r += factor * f64::from(*u); } r } diff --git a/src/uucore/src/lib/features/tokenize/sub.rs b/src/uucore/src/lib/features/tokenize/sub.rs index c869a3564..0c3a68c3c 100644 --- a/src/uucore/src/lib/features/tokenize/sub.rs +++ b/src/uucore/src/lib/features/tokenize/sub.rs @@ -283,10 +283,10 @@ impl SubParser { } } else { if let Some(x) = n_ch { - it.put_back(x) + it.put_back(x); }; if let Some(x) = preface { - it.put_back(x) + it.put_back(x); }; false } diff --git a/src/uucore/src/lib/features/tokenize/unescaped_text.rs b/src/uucore/src/lib/features/tokenize/unescaped_text.rs index ffbcd4afe..a192c757b 100644 --- a/src/uucore/src/lib/features/tokenize/unescaped_text.rs +++ b/src/uucore/src/lib/features/tokenize/unescaped_text.rs @@ -227,7 +227,7 @@ impl UnescapedText { new_vec.extend(tmp_str.bytes()); tmp_str = String::new(); } - UnescapedText::handle_escaped(new_vec, it, subs_mode) + UnescapedText::handle_escaped(new_vec, it, subs_mode); } x if x == '%' && !subs_mode => { if let Some(follow) = it.next() { diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 2bbf85dc1..4c9d6c21d 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -97,7 +97,7 @@ pub fn get_utility_is_second_arg() -> bool { } pub fn set_utility_is_second_arg() { - crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst) + crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst); } // args_os() can be expensive to call, it copies all of argv before iterating. diff --git a/src/uucore/src/lib/mods/panic.rs b/src/uucore/src/lib/mods/panic.rs index dd0eff6a8..5a1e20d80 100644 --- a/src/uucore/src/lib/mods/panic.rs +++ b/src/uucore/src/lib/mods/panic.rs @@ -36,7 +36,7 @@ pub fn mute_sigpipe_panic() { let hook = panic::take_hook(); panic::set_hook(Box::new(move |info| { if !is_broken_pipe(info) { - hook(info) + hook(info); } })); } diff --git a/tests/by-util/test_chcon.rs b/tests/by-util/test_chcon.rs index 2bdc512d5..82dab9ae3 100644 --- a/tests/by-util/test_chcon.rs +++ b/tests/by-util/test_chcon.rs @@ -461,9 +461,9 @@ fn set_file_context(path: impl AsRef, context: &str) -> Result<(), selinux context, path.display(), r - ) + ); } else { - println!("set_file_context: '{}' => '{}'.", context, path.display()) + println!("set_file_context: '{}' => '{}'.", context, path.display()); } r } diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index d5ebb4600..0857e5659 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -48,7 +48,7 @@ mod test_passgrp { #[test] fn test_grp2gid() { if cfg!(target_os = "linux") || cfg!(target_os = "android") || cfg!(target_os = "windows") { - assert_eq!(0, grp2gid("root").unwrap()) + assert_eq!(0, grp2gid("root").unwrap()); } else { assert_eq!(0, grp2gid("wheel").unwrap()); } diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 135ee72ef..e1950f0df 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -187,7 +187,7 @@ fn test_change_directory() { .arg(pwd) .succeeds() .stdout_move_str(); - assert_eq!(out.trim(), temporary_path.as_os_str()) + assert_eq!(out.trim(), temporary_path.as_os_str()); } #[cfg(windows)] diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 559fe3f47..5a74ee755 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1551,7 +1551,7 @@ fn test_ls_inode() { assert!(!re_long.is_match(result.stdout_str())); assert!(!result.stdout_str().contains(inode_long)); - assert_eq!(inode_short, inode_long) + assert_eq!(inode_short, inode_long); } #[test] @@ -1901,7 +1901,7 @@ fn test_ls_version_sort() { assert_eq!( result.stdout_str().split('\n').collect::>(), expected, - ) + ); } #[test] diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index f3451fb5e..e1038003b 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -75,7 +75,7 @@ fn test_symbolic_mode() { ucmd.arg("-m").arg("a=rwx").arg(TEST_DIR1).succeeds(); let perms = at.metadata(TEST_DIR1).permissions().mode(); - assert_eq!(perms, 0o40777) + assert_eq!(perms, 0o40777); } #[test] @@ -85,7 +85,7 @@ fn test_symbolic_alteration() { ucmd.arg("-m").arg("-w").arg(TEST_DIR1).succeeds(); let perms = at.metadata(TEST_DIR1).permissions().mode(); - assert_eq!(perms, 0o40555) + assert_eq!(perms, 0o40555); } #[test] @@ -98,5 +98,5 @@ fn test_multi_symbolic() { .arg(TEST_DIR1) .succeeds(); let perms = at.metadata(TEST_DIR1).permissions().mode(); - assert_eq!(perms, 0o40750) + assert_eq!(perms, 0o40750); } diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 901b6f8be..86828dc45 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -91,7 +91,7 @@ fn test_head_count() { result_seq.iter().all(|x| input_seq.contains(x)), "Output includes element not from input: {}", result.stdout_str() - ) + ); } #[test] @@ -129,7 +129,7 @@ fn test_repeat() { .iter() .filter(|x| !input_seq.contains(x)) .collect::>() - ) + ); } #[test] diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d472d4b5e..5cf622fb8 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -155,7 +155,7 @@ fn test_multiple_decimals_general() { test_helper( "multiple_decimals_general", &["-g", "--general-numeric-sort", "--sort=general-numeric"], - ) + ); } #[test] @@ -163,7 +163,7 @@ fn test_multiple_decimals_numeric() { test_helper( "multiple_decimals_numeric", &["-n", "--numeric-sort", "--sort=numeric"], - ) + ); } #[test] @@ -171,7 +171,7 @@ fn test_numeric_with_trailing_invalid_chars() { test_helper( "numeric_trailing_chars", &["-n", "--numeric-sort", "--sort=numeric"], - ) + ); } #[test] @@ -588,7 +588,7 @@ fn test_keys_with_options_blanks_start() { #[test] fn test_keys_blanks_with_char_idx() { - test_helper("keys_blanks", &["-k 1.2b"]) + test_helper("keys_blanks", &["-k 1.2b"]); } #[test] @@ -648,7 +648,7 @@ fn test_keys_negative_size_match() { #[test] fn test_keys_ignore_flag() { - test_helper("keys_ignore_flag", &["-k 1n -b"]) + test_helper("keys_ignore_flag", &["-k 1n -b"]); } #[test] diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 983d14fe2..e661907cc 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -27,7 +27,7 @@ fn get_symlink_times(at: &AtPath, path: &str) -> (FileTime, FileTime) { } fn set_file_times(at: &AtPath, path: &str, atime: FileTime, mtime: FileTime) { - filetime::set_file_times(&at.plus_as_string(path), atime, mtime).unwrap() + filetime::set_file_times(&at.plus_as_string(path), atime, mtime).unwrap(); } // Adjusts for local timezone diff --git a/tests/common/util.rs b/tests/common/util.rs index f86cf2d26..5b293c216 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -241,7 +241,7 @@ impl CmdResult { "stdout was {}\nExpected any of {:#?}", self.stdout_str(), expected - ) + ); } self } @@ -419,14 +419,14 @@ impl CmdResult { pub fn stdout_matches(&self, regex: ®ex::Regex) -> &CmdResult { if !regex.is_match(self.stdout_str().trim()) { - panic!("Stdout does not match regex:\n{}", self.stdout_str()) + panic!("Stdout does not match regex:\n{}", self.stdout_str()); } self } pub fn stdout_does_not_match(&self, regex: ®ex::Regex) -> &CmdResult { if regex.is_match(self.stdout_str().trim()) { - panic!("Stdout matches regex:\n{}", self.stdout_str()) + panic!("Stdout matches regex:\n{}", self.stdout_str()); } self } @@ -1059,7 +1059,7 @@ impl UCommand { .write_all(input); if !self.ignore_stdin_write_error { if let Err(e) = write_result { - panic!("failed to write to stdin of child: {}", e) + panic!("failed to write to stdin of child: {}", e); } } }