From 63b55b14b39ec40b762bac30a83d9d790c8294d5 Mon Sep 17 00:00:00 2001 From: sholderbach Date: Fri, 26 Jul 2024 10:42:56 +0200 Subject: [PATCH] Using `inspect` instead of `map` --- crates/nu-protocol/src/signature.rs | 5 ++--- crates/nu-system/src/foreground.rs | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/nu-protocol/src/signature.rs b/crates/nu-protocol/src/signature.rs index f8b83063d7..c67e8a604e 100644 --- a/crates/nu-protocol/src/signature.rs +++ b/crates/nu-protocol/src/signature.rs @@ -467,13 +467,12 @@ impl Signature { /// Checks if short or long are already present /// Panics if one of them is found fn check_names(&self, name: impl Into, short: Option) -> (String, Option) { - let s = short.map(|c| { + let s = short.inspect(|c| { assert!( - !self.get_shorts().contains(&c), + !self.get_shorts().contains(c), "There may be duplicate short flags for '-{}'", c ); - c }); let name = { diff --git a/crates/nu-system/src/foreground.rs b/crates/nu-system/src/foreground.rs index bd78f616aa..93f7dd35c0 100644 --- a/crates/nu-system/src/foreground.rs +++ b/crates/nu-system/src/foreground.rs @@ -61,9 +61,8 @@ impl ForegroundChild { pipeline_state: Some(pipeline_state.clone()), } }) - .map_err(|e| { + .inspect_err(|_e| { foreground_pgroup::reset(); - e }) } else { command.spawn().map(|child| Self {