1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-04 15:07:47 +00:00

refactor/polish ~ fix cargo clippy complaints (redundant return)

This commit is contained in:
Roy Ivy III 2019-12-26 11:13:03 -06:00
parent 564168ccfc
commit 88a45a157b
8 changed files with 15 additions and 15 deletions

View file

@ -294,7 +294,7 @@ impl<'a> State<'a> {
}
}
return None;
None
}
/// Print lines in the buffers as headers.

View file

@ -285,7 +285,7 @@ fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
if options.opt_present("B") && name.ends_with('~') {
return false;
}
return true;
true
}
fn enter_directory(dir: &PathBuf, options: &getopts::Matches) {

View file

@ -432,6 +432,6 @@ fn is_empty_dir(path: &PathBuf) -> bool {
Ok(contents) => {
return contents.peekable().peek().is_none();
},
Err(_e) => { return false; }
Err(_e) => { false }
}
}

View file

@ -254,7 +254,7 @@ fn is_format_size_decimal(
match ch {
Some(d) if d.is_digit(10) => {
decimal_size.push(d);
return true;
true
}
_ => false,
}
@ -264,7 +264,7 @@ fn is_format_dump_char(ch: Option<char>, show_ascii_dump: &mut bool) -> bool {
match ch {
Some('z') => {
*show_ascii_dump = true;
return true;
true
}
_ => false,
}

View file

@ -292,5 +292,5 @@ pub fn uumain(args: Vec<String>) -> i32 {
let printf_args = &args[2..];
memo::Memo::run_all(formatstr, printf_args);
}
return 0;
0
}

View file

@ -46,7 +46,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
if let Some(qchar) = byte_it.next() {
match qchar {
C_S_QUOTE | C_D_QUOTE => {
return Some(match byte_it.next() {
Some(match byte_it.next() {
Some(second_byte) => {
let mut ignored: Vec<u8> = Vec::new();
for cont in byte_it {
@ -63,11 +63,11 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
warn_expected_numeric(&so_far);
0 as u8
}
});
})
}
// first byte is not quote
_ => {
return None;
None
} // no first byte
}
} else {

View file

@ -337,14 +337,14 @@ fn exec_check_file(lines: Lines<BufReader<Box<dyn Read>>>, settings: &Settings)
// line, no matter what our merging function does.
if let Some(_last_line_or_next_error) = errors.next() {
println!("sort: disorder in line {}", first_error_index);
return 1;
1
} else {
// first "error" was actually the last line.
return 0;
0
}
} else {
// unwrapped_lines was empty. Empty files are defined to be sorted.
return 0;
0
}
}
@ -373,7 +373,7 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering {
}
}
}
return Ordering::Equal;
Ordering::Equal
}
/// Parse the beginning string into an f64, returning -inf instead of NaN on errors.

View file

@ -279,9 +279,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
};
match process.wait() {
Ok(status) => match status.code() {
Some(i) => return i,
Some(i) => i,
None => crash!(1, "process killed by signal {}", status.signal().unwrap()),
},
Err(e) => crash!(1, "{}", e),
};
}
}