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:
parent
564168ccfc
commit
88a45a157b
8 changed files with 15 additions and 15 deletions
|
@ -294,7 +294,7 @@ impl<'a> State<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print lines in the buffers as headers.
|
/// Print lines in the buffers as headers.
|
||||||
|
|
|
@ -285,7 +285,7 @@ fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
||||||
if options.opt_present("B") && name.ends_with('~') {
|
if options.opt_present("B") && name.ends_with('~') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enter_directory(dir: &PathBuf, options: &getopts::Matches) {
|
fn enter_directory(dir: &PathBuf, options: &getopts::Matches) {
|
||||||
|
|
|
@ -432,6 +432,6 @@ fn is_empty_dir(path: &PathBuf) -> bool {
|
||||||
Ok(contents) => {
|
Ok(contents) => {
|
||||||
return contents.peekable().peek().is_none();
|
return contents.peekable().peek().is_none();
|
||||||
},
|
},
|
||||||
Err(_e) => { return false; }
|
Err(_e) => { false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ fn is_format_size_decimal(
|
||||||
match ch {
|
match ch {
|
||||||
Some(d) if d.is_digit(10) => {
|
Some(d) if d.is_digit(10) => {
|
||||||
decimal_size.push(d);
|
decimal_size.push(d);
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ fn is_format_dump_char(ch: Option<char>, show_ascii_dump: &mut bool) -> bool {
|
||||||
match ch {
|
match ch {
|
||||||
Some('z') => {
|
Some('z') => {
|
||||||
*show_ascii_dump = true;
|
*show_ascii_dump = true;
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,5 +292,5 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let printf_args = &args[2..];
|
let printf_args = &args[2..];
|
||||||
memo::Memo::run_all(formatstr, printf_args);
|
memo::Memo::run_all(formatstr, printf_args);
|
||||||
}
|
}
|
||||||
return 0;
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
|
||||||
if let Some(qchar) = byte_it.next() {
|
if let Some(qchar) = byte_it.next() {
|
||||||
match qchar {
|
match qchar {
|
||||||
C_S_QUOTE | C_D_QUOTE => {
|
C_S_QUOTE | C_D_QUOTE => {
|
||||||
return Some(match byte_it.next() {
|
Some(match byte_it.next() {
|
||||||
Some(second_byte) => {
|
Some(second_byte) => {
|
||||||
let mut ignored: Vec<u8> = Vec::new();
|
let mut ignored: Vec<u8> = Vec::new();
|
||||||
for cont in byte_it {
|
for cont in byte_it {
|
||||||
|
@ -63,11 +63,11 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
|
||||||
warn_expected_numeric(&so_far);
|
warn_expected_numeric(&so_far);
|
||||||
0 as u8
|
0 as u8
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
// first byte is not quote
|
// first byte is not quote
|
||||||
_ => {
|
_ => {
|
||||||
return None;
|
None
|
||||||
} // no first byte
|
} // no first byte
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -337,14 +337,14 @@ fn exec_check_file(lines: Lines<BufReader<Box<dyn Read>>>, settings: &Settings)
|
||||||
// line, no matter what our merging function does.
|
// line, no matter what our merging function does.
|
||||||
if let Some(_last_line_or_next_error) = errors.next() {
|
if let Some(_last_line_or_next_error) = errors.next() {
|
||||||
println!("sort: disorder in line {}", first_error_index);
|
println!("sort: disorder in line {}", first_error_index);
|
||||||
return 1;
|
1
|
||||||
} else {
|
} else {
|
||||||
// first "error" was actually the last line.
|
// first "error" was actually the last line.
|
||||||
return 0;
|
0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// unwrapped_lines was empty. Empty files are defined to be sorted.
|
// 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.
|
/// Parse the beginning string into an f64, returning -inf instead of NaN on errors.
|
||||||
|
|
|
@ -279,9 +279,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
match process.wait() {
|
match process.wait() {
|
||||||
Ok(status) => match status.code() {
|
Ok(status) => match status.code() {
|
||||||
Some(i) => return i,
|
Some(i) => i,
|
||||||
None => crash!(1, "process killed by signal {}", status.signal().unwrap()),
|
None => crash!(1, "process killed by signal {}", status.signal().unwrap()),
|
||||||
},
|
},
|
||||||
Err(e) => crash!(1, "{}", e),
|
Err(e) => crash!(1, "{}", e),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue