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,11 +277,9 @@ fn max(lhs: usize, rhs: usize) -> usize {
|
|||
fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
||||
let ffi_name = entry.file_name();
|
||||
let name = ffi_name.to_string_lossy();
|
||||
if !options.opt_present("a") && !options.opt_present("A") {
|
||||
if name.starts_with('.') {
|
||||
if !options.opt_present("a") && !options.opt_present("A") && name.starts_with('.') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if options.opt_present("B") && name.ends_with('~') {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -359,13 +359,11 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
|||
fs::rename(to, p)?;
|
||||
}
|
||||
|
||||
if b.update {
|
||||
if fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()?
|
||||
if b.update && fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()?
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "to" may no longer exist if it was backed up
|
||||
if to.exists() && to.is_dir() {
|
||||
|
|
|
@ -105,11 +105,9 @@ fn replace_fds() {
|
|||
}
|
||||
}
|
||||
|
||||
if is_stderr_interactive() {
|
||||
if unsafe { dup2(1, 2) } != 2 {
|
||||
if is_stderr_interactive() && unsafe { dup2(1, 2) } != 2 {
|
||||
crash!(2, "Cannot replace STDERR: {}", Error::last_os_error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn find_stdout() -> File {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue