1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

truncate: use map_err instead of unwrap_or_else

This commit is contained in:
Sam Caldwell 2022-02-01 14:13:52 -07:00
parent ea5541db56
commit 39f8329222

View file

@ -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)