mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 06:42:42 +00:00
core: remove unnecessary if statement in update control
This commit is contained in:
parent
460d346069
commit
3b8f3d04f4
1 changed files with 6 additions and 10 deletions
|
@ -122,16 +122,12 @@ pub mod arguments {
|
|||
/// assert_eq!(update_mode, UpdateMode::ReplaceAll)
|
||||
/// }
|
||||
pub fn determine_update_mode(matches: &ArgMatches) -> UpdateMode {
|
||||
if matches.contains_id(arguments::OPT_UPDATE) {
|
||||
if let Some(mode) = matches.get_one::<String>(arguments::OPT_UPDATE) {
|
||||
match mode.as_str() {
|
||||
"all" => UpdateMode::ReplaceAll,
|
||||
"none" => UpdateMode::ReplaceNone,
|
||||
"older" => UpdateMode::ReplaceIfOlder,
|
||||
_ => unreachable!("other args restricted by clap"),
|
||||
}
|
||||
} else {
|
||||
unreachable!("other args restricted by clap")
|
||||
if let Some(mode) = matches.get_one::<String>(arguments::OPT_UPDATE) {
|
||||
match mode.as_str() {
|
||||
"all" => UpdateMode::ReplaceAll,
|
||||
"none" => UpdateMode::ReplaceNone,
|
||||
"older" => UpdateMode::ReplaceIfOlder,
|
||||
_ => unreachable!("other args restricted by clap"),
|
||||
}
|
||||
} else if matches.get_flag(arguments::OPT_UPDATE_NO_ARG) {
|
||||
// short form of this option is equivalent to using --update=older
|
||||
|
|
Loading…
Reference in a new issue