refactor: Switch to getter for number_of_values

This commit is contained in:
Ed Page 2022-07-29 14:51:02 -05:00
parent f40447bc26
commit b47464955c
2 changed files with 3 additions and 3 deletions

View file

@ -4531,7 +4531,7 @@ pub(crate) fn render_arg_val(arg: &Arg) -> String {
let mut extra_values = false;
debug_assert!(arg.is_takes_value_set());
let num_vals = arg.num_vals.unwrap_or_else(|| {
let num_vals = arg.get_num_vals().unwrap_or_else(|| {
if arg.is_multiple_values_set() {
(1..).into()
} else {
@ -4547,7 +4547,7 @@ pub(crate) fn render_arg_val(arg: &Arg) -> String {
}
rendered.push_str(&arg_name);
}
extra_values |= arg.num_vals.is_none() && arg.is_multiple_values_set();
extra_values |= arg.get_num_vals().is_none() && arg.is_multiple_values_set();
extra_values |= min < num_vals.max_values();
} else {
debug_assert!(1 < val_names.len());

View file

@ -270,7 +270,7 @@ impl<'help, 'cmd> Validator<'help, 'cmd> {
));
}
if let Some(expected) = a.num_vals {
if let Some(expected) = a.get_num_vals() {
if let Some(expected) = expected.num_values() {
if expected != actual {
debug!(