Fix clippy

This commit is contained in:
Donough Liu 2020-12-25 02:36:46 +08:00
parent ad3d3a13cd
commit 53fdc9d6b2

View file

@ -1593,15 +1593,13 @@ impl<'help, 'app> Parser<'help, 'app> {
for a in self.app.args.args.iter() { for a in self.app.args.args.iter() {
// Use env only if the arg was not present among command line args // 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 matcher.get(&a.id).map_or(true, |a| a.occurs == 0) {
if let Some((_, ref val)) = a.env { if let Some((_, Some(ref val))) = a.env {
if let Some(ref val) = val { let val = &ArgStr::new(val);
let val = &ArgStr::new(val); if a.is_set(ArgSettings::TakesValue) {
if a.is_set(ArgSettings::TakesValue) { self.add_val_to_arg(a, val, matcher, ValueType::EnvVariable)?;
self.add_val_to_arg(a, val, matcher, ValueType::EnvVariable)?; } else {
} else { self.check_for_help_and_version_str(val)?;
self.check_for_help_and_version_str(val)?; matcher.add_index_to(&a.id, self.cur_idx.get(), ValueType::EnvVariable);
matcher.add_index_to(&a.id, self.cur_idx.get(), ValueType::EnvVariable);
}
} }
} }
} }