diff --git a/src/parse/matches/matched_arg.rs b/src/parse/matches/matched_arg.rs index cd06c471..c2d86f44 100644 --- a/src/parse/matches/matched_arg.rs +++ b/src/parse/matches/matched_arg.rs @@ -77,7 +77,7 @@ impl MatchedArg { self.vals.last().map(|x| x.len()).unwrap_or(0) } - pub(crate) fn is_vals_empty(&self) -> bool { + pub(crate) fn all_val_groups_empty(&self) -> bool { self.vals.iter().flatten().count() == 0 } diff --git a/src/parse/parser.rs b/src/parse/parser.rs index fd6e2243..dd4953c6 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -1638,7 +1638,7 @@ impl<'help, 'app> Parser<'help, 'app> { arg.name ); match matcher.get(&arg.id) { - Some(ma) if ma.is_vals_empty() => { + Some(ma) if ma.all_val_groups_empty() => { debug!( "Parser::add_value:iter:{}: has no user defined vals", arg.name diff --git a/src/parse/validator.rs b/src/parse/validator.rs index 48dd4671..3098b879 100644 --- a/src/parse/validator.rs +++ b/src/parse/validator.rs @@ -42,7 +42,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> { let o = &self.p.app[&a]; reqs_validated = true; let should_err = if let Some(v) = matcher.0.args.get(&o.id) { - v.is_vals_empty() && !(o.min_vals.is_some() && o.min_vals.unwrap() == 0) + v.all_val_groups_empty() && !(o.min_vals.is_some() && o.min_vals.unwrap() == 0) } else { true }; @@ -396,7 +396,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> { }; // Issue 665 (https://github.com/clap-rs/clap/issues/665) // Issue 1105 (https://github.com/clap-rs/clap/issues/1105) - if a.is_set(ArgSettings::TakesValue) && !min_vals_zero && ma.is_vals_empty() { + if a.is_set(ArgSettings::TakesValue) && !min_vals_zero && ma.all_val_groups_empty() { return Err(Error::empty_value( self.p.app, a,