diff --git a/src/mv/mv.rs b/src/mv/mv.rs index 91fa65039..4c99f77ad 100644 --- a/src/mv/mv.rs +++ b/src/mv/mv.rs @@ -202,12 +202,10 @@ fn determine_backup_suffix(backup_mode: BackupMode, matches: &getopts::Matches) ); } } + } else if let (Ok(s), BackupMode::SimpleBackup) = (env::var("SIMPLE_BACKUP_SUFFIX"), backup_mode) { + s } else { - if let (Ok(s), BackupMode::SimpleBackup) = (env::var("SIMPLE_BACKUP_SUFFIX"), backup_mode) { - s - } else { - "~".to_owned() - } + "~".to_owned() } } diff --git a/src/nproc/nproc.rs b/src/nproc/nproc.rs index 6a35520cd..0b7d48ceb 100644 --- a/src/nproc/nproc.rs +++ b/src/nproc/nproc.rs @@ -115,12 +115,10 @@ fn num_cpus_all() -> usize { // In some situation, /proc and /sys are not mounted, and sysconf returns 1. // However, we want to guarantee that `nproc --all` >= `nproc`. num_cpus::get() + } else if nprocs > 0 { + nprocs as usize } else { - if nprocs > 0 { - nprocs as usize - } else { - 1 - } + 1 } } diff --git a/src/pinky/pinky.rs b/src/pinky/pinky.rs index 7b6c0ab5f..f604846d5 100644 --- a/src/pinky/pinky.rs +++ b/src/pinky/pinky.rs @@ -290,10 +290,8 @@ impl Pinky { if ut.is_user_process() { if self.names.is_empty() { self.print_entry(&ut) - } else { - if self.names.iter().any(|n| n.as_str() == ut.user()) { + } else if self.names.iter().any(|n| n.as_str() == ut.user()) { self.print_entry(&ut); - } } } } diff --git a/src/printf/tokenize/num_format/formatters/float_common.rs b/src/printf/tokenize/num_format/formatters/float_common.rs index 5e051055f..aefc024a3 100644 --- a/src/printf/tokenize/num_format/formatters/float_common.rs +++ b/src/printf/tokenize/num_format/formatters/float_common.rs @@ -27,12 +27,10 @@ fn has_enough_digits( } else { false //undecidable without converting } - } else { - if hex_input { + } else if hex_input { ((((string_position - 1) - starting_position) * 9) / 8 >= limit) - } else { + } else { ((string_position - 1) - starting_position >= limit) - } } } diff --git a/src/ptx/ptx.rs b/src/ptx/ptx.rs index 1d5fd0431..9e7573c25 100644 --- a/src/ptx/ptx.rs +++ b/src/ptx/ptx.rs @@ -189,14 +189,12 @@ fn read_input(input_files: &[String], config: &Config) -> HashMap bool { } } else if options.dir && (!is_root || !options.preserve_root) { had_err = remove_dir(path, options).bitor(had_err); + } else if options.recursive { + show_error!("could not remove directory '{}'", path.display()); + had_err = true; } else { - if options.recursive { - show_error!("could not remove directory '{}'", path.display()); - had_err = true; - } else { - show_error!( - "could not remove directory '{}' (did you mean to pass '-r'?)", - path.display() - ); - had_err = true; - } + show_error!( + "could not remove directory '{}' (did you mean to pass '-r'?)", + path.display() + ); + had_err = true; } had_err diff --git a/src/sort/sort.rs b/src/sort/sort.rs index db12e5779..28cfea176 100644 --- a/src/sort/sort.rs +++ b/src/sort/sort.rs @@ -302,12 +302,10 @@ fn exec(files: Vec, settings: &Settings) -> i32 { } else { print_sorted(file_merger, &settings.outfile) } + } else if settings.unique { + print_sorted(lines.iter().dedup(), &settings.outfile) } else { - if settings.unique { - print_sorted(lines.iter().dedup(), &settings.outfile) - } else { - print_sorted(lines.iter(), &settings.outfile) - } + print_sorted(lines.iter(), &settings.outfile) } 0 diff --git a/src/touch/touch.rs b/src/touch/touch.rs index 5d67f5237..503ee062e 100644 --- a/src/touch/touch.rs +++ b/src/touch/touch.rs @@ -182,10 +182,8 @@ pub fn uumain(args: Vec) -> i32 { if let Err(e) = set_symlink_file_times(path, atime, mtime) { show_warning!("cannot touch '{}': {}", path, e); } - } else { - if let Err(e) = filetime::set_file_times(path, atime, mtime) { + } else if let Err(e) = filetime::set_file_times(path, atime, mtime) { show_warning!("cannot touch '{}': {}", path, e); - } } }