diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs index 1b67908d..28ec97c7 100644 --- a/src/build/app/mod.rs +++ b/src/build/app/mod.rs @@ -1408,12 +1408,9 @@ impl<'b> App<'b> { self._build(); } - { - let mut parser = Parser::new(self); - - // do the real parsing - parser.get_matches_with(&mut matcher, it)?; - } + // do the real parsing + let mut parser = Parser::new(self); + parser.get_matches_with(&mut matcher, it)?; let global_arg_vec: Vec = self .args @@ -1438,13 +1435,12 @@ impl<'b> App<'b> { self._derive_display_order(); self._create_help_and_version(); + // Perform expensive debug assertions - debug_assert!({ - for a in self.args.args.iter() { - self._arg_debug_asserts(a); - } - true - }); + #[cfg(debug_assertions)] + for a in self.args.args.iter() { + self._arg_debug_asserts(a); + } let mut pos_counter = 1; for a in self.args.args.iter_mut() { diff --git a/src/mkeymap.rs b/src/mkeymap.rs index d1e4097b..f279deb6 100644 --- a/src/mkeymap.rs +++ b/src/mkeymap.rs @@ -153,22 +153,20 @@ impl<'b> MKeyMap<'b> { let positional; let mut longs: Vec<_>; - { - let arg = &self.args[index]; - short = arg.short.map(KeyType::Short); - positional = arg.index.map(KeyType::Position); + let arg = &self.args[index]; + short = arg.short.map(KeyType::Short); + positional = arg.index.map(KeyType::Position); - longs = arg - .aliases - .clone() - .map(|v| { - v.iter() - .map(|(n, _)| KeyType::Long(OsString::from(n))) - .collect() - }) - .unwrap_or_default(); - longs.extend(arg.long.map(|l| KeyType::Long(OsString::from(l)))); - } + longs = arg + .aliases + .clone() + .map(|v| { + v.iter() + .map(|(n, _)| KeyType::Long(OsString::from(n))) + .collect() + }) + .unwrap_or_default(); + longs.extend(arg.long.map(|l| KeyType::Long(OsString::from(l)))); if let Some(s) = short { self.insert_key(s, index) diff --git a/src/parse/validator.rs b/src/parse/validator.rs index f310f84c..8df7890c 100644 --- a/src/parse/validator.rs +++ b/src/parse/validator.rs @@ -41,9 +41,8 @@ impl<'b, 'c, 'z> Validator<'b, 'c, 'z> { self.p.add_defaults(matcher)?; if let ParseResult::Opt(a) = needs_val_of { debugln!("Validator::validate: needs_val_of={:?}", a); - { - self.validate_required(matcher)?; - } + self.validate_required(matcher)?; + let o = self.p.app.find(a).expect(INTERNAL_ERROR_MSG); reqs_validated = true; let should_err = if let Some(v) = matcher.0.args.get(&o.id) {