mirror of
https://github.com/clap-rs/clap
synced 2025-01-18 23:53:54 +00:00
refactor: removes legacy panics and fixes grammar
This commit is contained in:
parent
1ac7e99491
commit
958ebb8629
2 changed files with 2 additions and 18 deletions
|
@ -55,8 +55,8 @@ impl<'n> OptBuilder<'n> {
|
|||
pub fn from_arg(a: &Arg<'n, 'n, 'n, 'n, 'n,'n>,
|
||||
reqs: &mut Vec<&'n str>) -> Self {
|
||||
if a.short.is_none() && a.long.is_none() {
|
||||
panic!("Argument \"{}\" has take_value(true), yet neither a short() or long() \
|
||||
were supplied", a.name);
|
||||
panic!("Argument \"{}\" has takes_value(true), yet neither a short() or long() \
|
||||
was supplied", a.name);
|
||||
}
|
||||
// No need to check for .index() as that is handled above
|
||||
let mut ob = OptBuilder {
|
||||
|
@ -93,14 +93,6 @@ impl<'n> OptBuilder<'n> {
|
|||
if let Some(ref vec) = ob.val_names {
|
||||
ob.num_vals = Some(vec.len() as u8);
|
||||
}
|
||||
if ob.min_vals.is_some() && !a.multiple {
|
||||
panic!("Argument \"{}\" does not allow multiple values, yet it is expecting {} \
|
||||
values", ob.name, ob.num_vals.unwrap());
|
||||
}
|
||||
if ob.max_vals.is_some() && !a.multiple {
|
||||
panic!("Argument \"{}\" does not allow multiple values, yet it is expecting {} \
|
||||
values", ob.name, ob.num_vals.unwrap());
|
||||
}
|
||||
// Check if there is anything in the blacklist (mutually excludes list) and add any
|
||||
// values
|
||||
if let Some(ref bl) = a.blacklist {
|
||||
|
|
|
@ -93,14 +93,6 @@ impl<'n> PosBuilder<'n> {
|
|||
if a.hidden {
|
||||
pb.settings.set(&ArgSettings::Hidden);
|
||||
}
|
||||
if pb.min_vals.is_some() && !a.multiple {
|
||||
panic!("Argument \"{}\" does not allow multiple values, yet it is expecting {} \
|
||||
values", pb.name, pb.num_vals.unwrap());
|
||||
}
|
||||
if pb.max_vals.is_some() && !a.multiple {
|
||||
panic!("Argument \"{}\" does not allow multiple values, yet it is expecting {} \
|
||||
values", pb.name, pb.num_vals.unwrap());
|
||||
}
|
||||
// Check if there is anything in the blacklist (mutually excludes list) and add any
|
||||
// values
|
||||
if let Some(ref bl) = a.blacklist {
|
||||
|
|
Loading…
Reference in a new issue