From 53fdc9d6b2ee6abd122d80b17e1842798447d638 Mon Sep 17 00:00:00 2001 From: Donough Liu Date: Fri, 25 Dec 2020 02:36:46 +0800 Subject: [PATCH] Fix clippy --- src/parse/parser.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 0d36e654..55835b73 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -1593,15 +1593,13 @@ impl<'help, 'app> Parser<'help, 'app> { for a in self.app.args.args.iter() { // Use env only if the arg was not present among command line args if matcher.get(&a.id).map_or(true, |a| a.occurs == 0) { - if let Some((_, ref val)) = a.env { - if let Some(ref val) = val { - let val = &ArgStr::new(val); - if a.is_set(ArgSettings::TakesValue) { - self.add_val_to_arg(a, val, matcher, ValueType::EnvVariable)?; - } else { - self.check_for_help_and_version_str(val)?; - matcher.add_index_to(&a.id, self.cur_idx.get(), ValueType::EnvVariable); - } + if let Some((_, Some(ref val))) = a.env { + let val = &ArgStr::new(val); + if a.is_set(ArgSettings::TakesValue) { + self.add_val_to_arg(a, val, matcher, ValueType::EnvVariable)?; + } else { + self.check_for_help_and_version_str(val)?; + matcher.add_index_to(&a.id, self.cur_idx.get(), ValueType::EnvVariable); } } }