mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (collapse if-if)
This commit is contained in:
parent
b8eb763e43
commit
b003d55fe1
3 changed files with 7 additions and 13 deletions
|
@ -277,10 +277,8 @@ fn max(lhs: usize, rhs: usize) -> usize {
|
||||||
fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
||||||
let ffi_name = entry.file_name();
|
let ffi_name = entry.file_name();
|
||||||
let name = ffi_name.to_string_lossy();
|
let name = ffi_name.to_string_lossy();
|
||||||
if !options.opt_present("a") && !options.opt_present("A") {
|
if !options.opt_present("a") && !options.opt_present("A") && name.starts_with('.') {
|
||||||
if name.starts_with('.') {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if options.opt_present("B") && name.ends_with('~') {
|
if options.opt_present("B") && name.ends_with('~') {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -359,11 +359,9 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
||||||
fs::rename(to, p)?;
|
fs::rename(to, p)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.update {
|
if b.update && fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()?
|
||||||
if fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()?
|
{
|
||||||
{
|
return Ok(());
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,8 @@ fn replace_fds() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_stderr_interactive() {
|
if is_stderr_interactive() && unsafe { dup2(1, 2) } != 2 {
|
||||||
if unsafe { dup2(1, 2) } != 2 {
|
crash!(2, "Cannot replace STDERR: {}", Error::last_os_error())
|
||||||
crash!(2, "Cannot replace STDERR: {}", Error::last_os_error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue