mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
chore: fix unnecessary_semicolon lint
I used this command: ```sh __CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --all-features --allow-dirty ```
This commit is contained in:
committed by
Daniel Hofstetter
parent
9ee7962575
commit
4a2634989c
@@ -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
|
||||
|
||||
@@ -670,7 +670,7 @@ fn write_tab_to_end<W: Write>(mut in_buf: &[u8], writer: &mut W) -> usize {
|
||||
writer.write_all(in_buf).unwrap();
|
||||
return in_buf.len() + count;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
match matches.get_many::<OsString>(options::FILE) {
|
||||
Some(files) => cksum(opts, files.map(OsStr::new))?,
|
||||
None => cksum(opts, iter::once(OsStr::new("-")))?,
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+5
-5
@@ -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<F: Fn() -> 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
|
||||
|
||||
+18
-18
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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.
|
||||
|
||||
Vendored
+1
-1
@@ -111,7 +111,7 @@ impl<'a> SplitIterator<'a> {
|
||||
(None, Some(default)) => {
|
||||
self.expander.put_native_string(default);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -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();
|
||||
|
||||
@@ -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])?;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ impl NumericOp {
|
||||
Self::Mod => {
|
||||
if a.checked_div(&b).is_none() {
|
||||
return Err(ExprError::DivisionByZero);
|
||||
};
|
||||
}
|
||||
a % b
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -169,7 +169,7 @@ impl FmtOptions {
|
||||
return Err(FmtError::InvalidTabWidth(s.clone()).into());
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
if tabwidth < 1 {
|
||||
tabwidth = 1;
|
||||
|
||||
@@ -136,7 +136,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
|
||||
bits: *bits,
|
||||
})?,
|
||||
None => return Err(ChecksumError::BitsRequiredForShake128.into()),
|
||||
};
|
||||
}
|
||||
}
|
||||
if matches.get_flag("shake256") {
|
||||
match matches.get_one::<usize>("bits") {
|
||||
@@ -146,7 +146,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
|
||||
bits: *bits,
|
||||
})?,
|
||||
None => return Err(ChecksumError::BitsRequiredForShake256.into()),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if alg.is_none() {
|
||||
|
||||
@@ -395,7 +395,7 @@ where
|
||||
assert_eq!(lines, 0);
|
||||
lines = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for separator_offset in memrchr_iter(separator, &buffer[..]) {
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -1087,11 +1087,11 @@ fn exec<Sep: Separator>(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()?;
|
||||
|
||||
|
||||
+5
-5
@@ -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 {
|
||||
|
||||
+4
-4
@@ -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)?;
|
||||
|
||||
@@ -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<u16>) {
|
||||
if option_line.is_none() {
|
||||
self.content_rows = row.saturating_sub(1) as usize;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn draw(&mut self, wrong_key: Option<char>) -> 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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user