Using inspect instead of map

This commit is contained in:
sholderbach 2024-07-26 10:42:56 +02:00
parent f09b2dd0ab
commit 63b55b14b3
2 changed files with 3 additions and 5 deletions

View File

@ -467,13 +467,12 @@ impl Signature {
/// Checks if short or long are already present /// Checks if short or long are already present
/// Panics if one of them is found /// Panics if one of them is found
fn check_names(&self, name: impl Into<String>, short: Option<char>) -> (String, Option<char>) { fn check_names(&self, name: impl Into<String>, short: Option<char>) -> (String, Option<char>) {
let s = short.map(|c| { let s = short.inspect(|c| {
assert!( assert!(
!self.get_shorts().contains(&c), !self.get_shorts().contains(c),
"There may be duplicate short flags for '-{}'", "There may be duplicate short flags for '-{}'",
c c
); );
c
}); });
let name = { let name = {

View File

@ -61,9 +61,8 @@ impl ForegroundChild {
pipeline_state: Some(pipeline_state.clone()), pipeline_state: Some(pipeline_state.clone()),
} }
}) })
.map_err(|e| { .inspect_err(|_e| {
foreground_pgroup::reset(); foreground_pgroup::reset();
e
}) })
} else { } else {
command.spawn().map(|child| Self { command.spawn().map(|child| Self {