Skip to content

Commit 5f140ba

Browse files
sylvestrecakebaker
andauthored
Update src/uucore/src/lib/mods/clap_localization.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
1 parent b5bdfdc commit 5f140ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/uucore/src/lib/mods/clap_localization.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,13 @@ where
479479
I: IntoIterator<Item = T>,
480480
T: Into<OsString> + Clone,
481481
{
482-
match cmd.try_get_matches_from(itr) {
483-
Ok(matches) => Ok(matches),
484-
Err(e) if e.exit_code() == 0 => Err(e.into()), // Preserve help/version
485-
Err(e) => {
486-
handle_clap_error_with_exit_code(e, exit_code);
482+
cmd.try_get_matches_from(itr).map_err(|e| {
483+
if e.exit_code() == 0 {
484+
e.into() // Preserve help/version
485+
} else {
486+
handle_clap_error_with_exit_code(e, exit_code)
487487
}
488-
}
488+
})
489489
}
490490

491491
/// Handles a clap error directly with a custom exit code.

0 commit comments

Comments
 (0)