mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
truncate: use map_err instead of unwrap_or_else
This commit is contained in:
@@ -116,15 +116,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
.override_usage(&usage[..])
|
||||
.after_help(&long_usage[..])
|
||||
.try_get_matches_from(args)
|
||||
.unwrap_or_else(|e| {
|
||||
.map_err(|e| {
|
||||
e.print().expect("Error writing clap::Error");
|
||||
match e.kind {
|
||||
clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => {
|
||||
std::process::exit(0)
|
||||
}
|
||||
_ => std::process::exit(1),
|
||||
clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => 0,
|
||||
_ => 1,
|
||||
}
|
||||
});
|
||||
})?;
|
||||
|
||||
let files: Vec<String> = matches
|
||||
.values_of(options::ARG_FILES)
|
||||
|
||||
Reference in New Issue
Block a user