mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
install : clean up returning Err
This commit is contained in:
parent
27ce4bb0a4
commit
d329c7c864
1 changed files with 6 additions and 18 deletions
|
@ -299,29 +299,17 @@ fn behavior(matches: &ArgMatches) -> Result<Behavior, i32> {
|
|||
let considering_dir: bool = MainFunction::Directory == main_function;
|
||||
|
||||
let specified_mode: Option<u32> = if matches.is_present(OPT_MODE) {
|
||||
match matches.value_of(OPT_MODE) {
|
||||
Some(x) => match mode::parse(x, considering_dir) {
|
||||
Ok(y) => Some(y),
|
||||
Err(err) => {
|
||||
show_error!("Invalid mode string: {}", err);
|
||||
return Err(1);
|
||||
}
|
||||
},
|
||||
None => {
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
let x = matches.value_of(OPT_MODE).ok_or(1)?;
|
||||
Some(mode::parse(x, considering_dir).map_err(|err| {
|
||||
show_error!("Invalid mode string: {}", err);
|
||||
1
|
||||
})?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let backup_suffix = if matches.is_present(OPT_SUFFIX) {
|
||||
match matches.value_of(OPT_SUFFIX) {
|
||||
Some(x) => x,
|
||||
None => {
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
matches.value_of(OPT_SUFFIX).ok_or(1)?
|
||||
} else {
|
||||
"~"
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue