diff --git a/Cargo.toml b/Cargo.toml index de0247310..ba21916d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -630,7 +630,6 @@ missing_errors_doc = "allow" # 1572 missing_panics_doc = "allow" # 946 must_use_candidate = "allow" # 322 match_same_arms = "allow" # 204 -unnecessary_semicolon = "allow" # 154 redundant_closure_for_method_calls = "allow" # 125 cast_possible_truncation = "allow" # 122 too_many_lines = "allow" # 101 diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index ad8fcf449..934e7c2ea 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -670,7 +670,7 @@ fn write_tab_to_end(mut in_buf: &[u8], writer: &mut W) -> usize { writer.write_all(in_buf).unwrap(); return in_buf.len() + count; } - }; + } } } diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index ad2b55801..2cc37f20c 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -338,7 +338,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match matches.get_many::(options::FILE) { Some(files) => cksum(opts, files.map(OsStr::new))?, None => cksum(opts, iter::once(OsStr::new("-")))?, - }; + } Ok(()) } diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 65519901b..3d0eef97b 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -819,7 +819,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { CpError::NotAllFilesCopied => {} // Else we caught a fatal bubbled-up error, log it to stderr _ => show_error!("{error}"), - }; + } set_exit_code(EXIT_ERR); } @@ -1046,7 +1046,7 @@ impl Options { if !dir.is_dir() { return Err(CpError::NotADirectory(dir.clone())); } - }; + } // cp follows POSIX conventions for overriding options such as "-a", // "-d", "--preserve", and "--no-preserve". We can use clap's // override-all behavior to achieve this, but there's a challenge: when @@ -1648,7 +1648,7 @@ fn handle_preserve CopyResult<()>>(p: &Preserve, f: F) -> CopyResult< show_error_if_needed(&error); } } - }; + } Ok(()) } @@ -2314,7 +2314,7 @@ fn handle_copy_mode( .open(dest) .unwrap(); } - }; + } Ok(PerformedAction::Copied) } @@ -2513,7 +2513,7 @@ fn copy_file( } return Ok(()); - }; + } } // Calculate the context upfront before canonicalizing the path diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index b24a8deef..e624a26b9 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -204,10 +204,10 @@ where (Err(err), _) => return Err(err), // continue the splitting process (Ok(()), _) => (), - }; + } } } - }; + } } Ok(()) } @@ -429,7 +429,7 @@ impl SplitWriter<'_> { self.writeln(&line)?; } _ => (), - }; + } offset -= 1; // write the extra lines required by the offset @@ -444,7 +444,7 @@ impl SplitWriter<'_> { pattern_as_str.to_string(), )); } - }; + } offset -= 1; } self.finish_split(); @@ -726,7 +726,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 1); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((1, Ok(line))) => { @@ -735,7 +735,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 2); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((2, Ok(line))) => { @@ -747,7 +747,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 2); } item => panic!("wrong item: {item:?}"), - }; + } input_splitter.rewind_buffer(); @@ -757,7 +757,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 1); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((2, Ok(line))) => { @@ -765,7 +765,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 0); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((3, Ok(line))) => { @@ -773,7 +773,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 0); } item => panic!("wrong item: {item:?}"), - }; + } assert!(input_splitter.next().is_none()); } @@ -799,7 +799,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 1); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((1, Ok(line))) => { @@ -808,7 +808,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 2); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((2, Ok(line))) => { @@ -817,7 +817,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 3); } item => panic!("wrong item: {item:?}"), - }; + } input_splitter.rewind_buffer(); @@ -828,7 +828,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 3); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((0, Ok(line))) => { @@ -836,7 +836,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 2); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((1, Ok(line))) => { @@ -844,7 +844,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 1); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((2, Ok(line))) => { @@ -852,7 +852,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 0); } item => panic!("wrong item: {item:?}"), - }; + } match input_splitter.next() { Some((3, Ok(line))) => { @@ -860,7 +860,7 @@ mod tests { assert_eq!(input_splitter.buffer_len(), 0); } item => panic!("wrong item: {item:?}"), - }; + } assert!(input_splitter.next().is_none()); } diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index d5778fce6..45adb41da 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -207,15 +207,15 @@ mod tests { match patterns.first() { Some(Pattern::UpToLine(24, ExecutePattern::Times(1))) => (), _ => panic!("expected UpToLine pattern"), - }; + } match patterns.get(1) { Some(Pattern::UpToLine(42, ExecutePattern::Always)) => (), _ => panic!("expected UpToLine pattern"), - }; + } match patterns.get(2) { Some(Pattern::UpToLine(50, ExecutePattern::Times(5))) => (), _ => panic!("expected UpToLine pattern"), - }; + } } #[test] @@ -242,42 +242,42 @@ mod tests { assert_eq!(parsed_reg, "test1.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } match patterns.get(1) { Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Always)) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test2.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } match patterns.get(2) { Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(5))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test3.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } match patterns.get(3) { Some(Pattern::UpToMatch(reg, 3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test4.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } match patterns.get(4) { Some(Pattern::UpToMatch(reg, 3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test5.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } match patterns.get(5) { Some(Pattern::UpToMatch(reg, -3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test6.*end$"); } _ => panic!("expected UpToMatch pattern"), - }; + } } #[test] @@ -304,42 +304,42 @@ mod tests { assert_eq!(parsed_reg, "test1.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } match patterns.get(1) { Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Always)) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test2.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } match patterns.get(2) { Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(5))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test3.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } match patterns.get(3) { Some(Pattern::SkipToMatch(reg, 3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test4.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } match patterns.get(4) { Some(Pattern::SkipToMatch(reg, 3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test5.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } match patterns.get(5) { Some(Pattern::SkipToMatch(reg, -3, ExecutePattern::Times(1))) => { let parsed_reg = format!("{reg}"); assert_eq!(parsed_reg, "test6.*end$"); } _ => panic!("expected SkipToMatch pattern"), - }; + } } #[test] diff --git a/src/uu/csplit/src/split_name.rs b/src/uu/csplit/src/split_name.rs index 5ac91bf92..33c606b48 100644 --- a/src/uu/csplit/src/split_name.rs +++ b/src/uu/csplit/src/split_name.rs @@ -81,7 +81,7 @@ mod tests { match split_name { Err(CsplitError::InvalidNumber(_)) => (), _ => panic!("should fail with InvalidNumber"), - }; + } } #[test] @@ -90,7 +90,7 @@ mod tests { match split_name { Err(CsplitError::SuffixFormatIncorrect) => (), _ => panic!("should fail with SuffixFormatIncorrect"), - }; + } } #[test] @@ -99,7 +99,7 @@ mod tests { match split_name { Err(CsplitError::SuffixFormatIncorrect) => (), _ => panic!("should fail with SuffixFormatIncorrect"), - }; + } } #[test] @@ -244,6 +244,6 @@ mod tests { match split_name { Err(CsplitError::SuffixFormatTooManyPercents) => (), _ => panic!("should fail with SuffixFormatTooManyPercents"), - }; + } } } diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index c4261c795..98707a4d0 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -368,7 +368,7 @@ impl<'a> Input<'a> { ), )); } - }; + } if settings.skip > 0 { src.skip(settings.skip)?; } @@ -1105,7 +1105,7 @@ fn dd_copy(mut i: Input, o: Output) -> io::Result<()> { output_thread, truncate, ); - }; + } // Create a common buffer with a capacity of the block size. // This is the max size needed. diff --git a/src/uu/env/src/split_iterator.rs b/src/uu/env/src/split_iterator.rs index 546a73038..a511fb9e0 100644 --- a/src/uu/env/src/split_iterator.rs +++ b/src/uu/env/src/split_iterator.rs @@ -111,7 +111,7 @@ impl<'a> SplitIterator<'a> { (None, Some(default)) => { self.expander.put_native_string(default); } - }; + } Ok(()) } diff --git a/src/uu/env/src/variable_parser.rs b/src/uu/env/src/variable_parser.rs index 2555c709f..da200c9db 100644 --- a/src/uu/env/src/variable_parser.rs +++ b/src/uu/env/src/variable_parser.rs @@ -87,7 +87,7 @@ impl<'a> VariableParser<'a, '_> { c.to_string(), )); } - }; + } } let default_opt = if let Some(default_end) = default_end { @@ -119,7 +119,7 @@ impl<'a> VariableParser<'a, '_> { self.skip_one()?; } Some(_) => break, - }; + } } let pos_end = self.parser.get_peek_position(); diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index dd9d56c9a..21ec08c2d 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -405,7 +405,7 @@ fn expand_line( output.write_all(&options.tspaces.as_bytes()[..nts])?; } else { output.write_all(" ".repeat(nts).as_bytes())?; - }; + } } else { output.write_all(&buf[byte..byte + nbytes])?; } diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index b0ae0142f..b68fcf342 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -110,7 +110,7 @@ impl NumericOp { Self::Mod => { if a.checked_div(&b).is_none() { return Err(ExprError::DivisionByZero); - }; + } a % b } })) diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index f6be36a3c..cde147fc9 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -169,7 +169,7 @@ impl FmtOptions { return Err(FmtError::InvalidTabWidth(s.clone()).into()); } }; - }; + } if tabwidth < 1 { tabwidth = 1; diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 1e215014a..5970e30f7 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -136,7 +136,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult { bits: *bits, })?, None => return Err(ChecksumError::BitsRequiredForShake128.into()), - }; + } } if matches.get_flag("shake256") { match matches.get_one::("bits") { @@ -146,7 +146,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult { bits: *bits, })?, None => return Err(ChecksumError::BitsRequiredForShake256.into()), - }; + } } if alg.is_none() { diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 565d363f4..6ad3156c5 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -395,7 +395,7 @@ where assert_eq!(lines, 0); lines = 1; } - }; + } } for separator_offset in memrchr_iter(separator, &buffer[..]) { diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 939e8599f..0b74e53fd 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -231,7 +231,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { // BSD's `id` ignores all but the first specified user pline(possible_pw.as_ref().map(|v| v.uid)); return Ok(()); - }; + } if matches.get_flag(options::OPT_HUMAN_READABLE) { // BSD's `id` ignores all but the first specified user pretty(possible_pw); diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index f1fb8b55a..b86a96a3e 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -1087,11 +1087,11 @@ fn exec(file1: &str, file2: &str, settings: Settings, sep: Sep) if let Err(e) = state1.finalize(&mut writer, &input, &repr) { writer.flush()?; return Err(e); - }; + } if let Err(e) = state2.finalize(&mut writer, &input, &repr) { writer.flush()?; return Err(e); - }; + } writer.flush()?; diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index cadc805ca..0fc2c6430 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -303,7 +303,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) ]) ) ); - }; + } } #[cfg(windows)] if target_dir.is_dir() { @@ -321,7 +321,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) ]) ) ); - }; + } } target_dir.to_path_buf() } else { @@ -433,17 +433,17 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> { return Err(LnError::SomeLinksFailed.into()); } - if fs::remove_file(dst).is_ok() {}; + if fs::remove_file(dst).is_ok() {} // In case of error, don't do anything } OverwriteMode::Force => { if !dst.is_symlink() && paths_refer_to_same_file(src, dst, true) { return Err(LnError::SameFile(src.to_owned(), dst.to_owned()).into()); } - if fs::remove_file(dst).is_ok() {}; + if fs::remove_file(dst).is_ok() {} // In case of error, don't do anything } - }; + } } if settings.symbolic { diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index fef646a65..ef7015e5f 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -2272,7 +2272,7 @@ fn enter_directory( let entry_path_data = PathData::new(dir_entry.path(), Some(Ok(dir_entry)), None, config, false); entries.push(entry_path_data); - }; + } } sort_entries(&mut entries, config, &mut state.out); @@ -2460,7 +2460,7 @@ fn display_additional_leading_info( write!(result, "{s} ").unwrap(); } else { write!(result, "{} ", pad_left(&s, padding.block_size)).unwrap(); - }; + } } Ok(result) } @@ -2594,7 +2594,7 @@ fn display_items( write!(state.out, "{}", config.line_ending)?; } } - }; + } } Ok(()) @@ -2814,7 +2814,7 @@ fn display_item_long( padding.minor, ); } - }; + } output_display.extend(b" "); display_date(md, config, state, &mut output_display)?; diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index bcf7300dd..7bda86030 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -570,7 +570,7 @@ impl<'a> Pager<'a> { fn handle_pattern_search(&mut self) -> UResult<()> { if self.pattern.is_none() { return Ok(()); - }; + } match self.search_pattern_in_file() { Some(line) => self.upper_mark = line, None => { @@ -769,7 +769,7 @@ impl<'a> Pager<'a> { fn page_resize(&mut self, _col: u16, row: u16, option_line: Option) { if option_line.is_none() { self.content_rows = row.saturating_sub(1) as usize; - }; + } } fn draw(&mut self, wrong_key: Option) -> UResult<()> { @@ -808,7 +808,7 @@ impl<'a> Pager<'a> { pattern, &format!("{}{pattern}{}", Attribute::Reverse, Attribute::Reset), ); - }; + } self.stdout.write_all(format!("\r{line}\n").as_bytes())?; lines_printed += 1; index += 1; diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index da019139d..7470a513c 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -406,7 +406,7 @@ fn handle_two_paths(source: &Path, target: &Path, opts: &Options) -> UResult<()> } } OverwriteMode::Force => {} - }; + } Err(MvError::NonDirectoryToDirectory( source.quote().to_string(), target.quote().to_string(), @@ -672,7 +672,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) match multi_progress { Some(ref pb) => pb.suspend(|| show!(e)), None => show!(e), - }; + } } Ok(()) => (), } @@ -749,7 +749,7 @@ fn rename( } } OverwriteMode::Force => {} - }; + } backup_path = backup_control::get_backup_path(opts.backup, to, &opts.suffix); if let Some(ref backup_path) = backup_path { @@ -805,7 +805,7 @@ fn rename( println!("{message}"); }), None => println!("{message}"), - }; + } } Ok(()) } diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 6678a1de9..c1631f809 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -346,7 +346,7 @@ fn nl(reader: &mut BufReader, stats: &mut Stats, settings: &Settings stats.consecutive_empty_lines += 1; } else { stats.consecutive_empty_lines = 0; - }; + } let new_numbering_style = match SectionDelimiter::parse(&line, &settings.section_delimiter) { diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 3a90849ff..fc8938923 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -72,7 +72,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if unsafe { !_vprocmgr_detach_from_console(0).is_null() } { return Err(NohupError::CannotDetach.into()); - }; + } let cstrs: Vec = matches .get_many::(options::CMD) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 7d362981c..62fe5c728 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -84,7 +84,7 @@ fn format_and_handle_validation(input_line: &str, options: &NumfmtOptions) -> UR show_error!("{error_message}"); } InvalidModes::Ignore => {} - }; + } println!("{input_line}"); } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index a5b4b0082..8f1f2f10b 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -541,7 +541,7 @@ where input_offset.print_final_offset(); return Err(1.into()); } - }; + } } if input_decoder.has_error() { diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index 654162381..d537350f1 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -47,7 +47,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match item?.write(stdout(), &mut args)? { ControlFlow::Continue(()) => {} ControlFlow::Break(()) => return Ok(()), - }; + } } args.start_next_batch(); @@ -74,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match item?.write(stdout(), &mut args)? { ControlFlow::Continue(()) => {} ControlFlow::Break(()) => return Ok(()), - }; + } } args.start_next_batch(); } diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index ebfb8c3bd..b4c51ad85 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -76,7 +76,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { HashMap::from([("arg".to_string(), second_file.quote().to_string())]), ), )); - }; + } Mode::Default(file.into()) }; diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index e1fdaf03a..674d6cdf9 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -75,7 +75,7 @@ fn sleep(args: &[&str]) -> UResult<()> { if arg_error { return Err(UUsageError::new(1, "")); - }; + } thread::sleep(sleep_dur); Ok(()) } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bc97581a5..66a245819 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1312,7 +1312,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { { settings.check_silent = true; settings.check = true; - }; + } settings.ignore_case = matches.get_flag(options::IGNORE_CASE); diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index eea97ed97..cd067703f 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -1403,7 +1403,7 @@ where // if there is nothing else to read - exit the loop if num_bytes_read == 0 { break; - }; + } let bytes = line.as_slice(); if let Some(chunk_number) = kth_chunk { diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index b777e213d..c33eb354f 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -109,7 +109,7 @@ fn pad_and_print(result: &str, left: bool, width: usize, padding: Padding) { (false, Padding::Space) => print!("{result:>width$}"), (true, Padding::Zero) => print!("{result:0 print!("{result: UResult> { HashMap::from([("name".to_string(), name.maybe_quote().to_string())]), ), )); - }; + } // Silent the warning as we want to the error message if path.metadata().is_err() { return Err(USimpleError::new( @@ -89,7 +89,7 @@ fn open(name: &str) -> UResult> { HashMap::from([("name".to_string(), name.maybe_quote().to_string())]), ), )); - }; + } let f = File::open(path).map_err_context(String::new)?; Ok(Box::new(f) as Box) } diff --git a/src/uu/tail/src/follow/watch.rs b/src/uu/tail/src/follow/watch.rs index 19c419cd4..c44d436b1 100644 --- a/src/uu/tail/src/follow/watch.rs +++ b/src/uu/tail/src/follow/watch.rs @@ -63,7 +63,7 @@ impl WatcherRx { HashMap::from([("path".to_string(), path.display().to_string())]), ), )); - }; + } } if path.is_relative() { path = path.canonicalize()?; @@ -255,7 +255,7 @@ impl Observer { watcher = Box::new(notify::PollWatcher::new(tx_clone, watcher_config).unwrap()); } Err(e) => return Err(USimpleError::new(1, e.to_string())), - }; + } } self.watcher_rx = Some(WatcherRx::new(watcher, rx)); diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 1d13e3168..444f4d42f 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -310,7 +310,7 @@ fn tail_stdin( observer.add_stdin(input.display_name.as_str(), Some(Box::new(reader)), true)?; } } - }; + } Ok(()) } diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 701edb1f8..21595be1c 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -504,7 +504,7 @@ fn touch_file( } show!(e); return Ok(()); - }; + } // Minor optimization: if no reference time, timestamp, or date was specified, we're done. if opts.source == Source::Now && opts.date.is_none() { @@ -924,6 +924,6 @@ mod tests { Err(TouchError::InvalidFiletime(filetime)) => assert_eq!(filetime, invalid_filetime), Err(e) => panic!("Expected TouchError::InvalidFiletime, got {e}"), Ok(_) => panic!("Expected to error with TouchError::InvalidFiletime but succeeded"), - }; + } } } diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 2bc529e7b..ae7efd85b 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -29,7 +29,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } else { Err(1.into()) }; - }; + } let mut stdout = std::io::stdout(); @@ -47,7 +47,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { // Don't return to prevent a panic later when another flush is attempted // because the `uucore_procs::main` macro inserts a flush after execution for every utility. std::process::exit(3); - }; + } Ok(()) } diff --git a/src/uu/wc/src/count_fast.rs b/src/uu/wc/src/count_fast.rs index c85fd5d80..9a473401e 100644 --- a/src/uu/wc/src/count_fast.rs +++ b/src/uu/wc/src/count_fast.rs @@ -69,7 +69,7 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result { } } Err(_) => return Err(byte_count), - }; + } } Ok(byte_count)