Skip to content

Commit

Permalink
refactor(help): Remove more redundant required checks
Browse files Browse the repository at this point in the history
Made redundant in clap-rs#3689 but missed updating these.
  • Loading branch information
epage committed May 6, 2022
1 parent dcda237 commit 05aecf8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/parse/parser.rs
Expand Up @@ -1468,11 +1468,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
let required = self.cmd.required_graph();
let used: Vec<Id> = matcher
.arg_names()
.filter(|n| {
self.cmd
.find(n)
.map_or(true, |a| !(required.contains(&a.id) || a.is_hide_set()))
})
.filter(|n| self.cmd.find(n).map_or(true, |a| !a.is_hide_set()))
.cloned()
.collect();

Expand Down
6 changes: 1 addition & 5 deletions src/parse/validator.rs
Expand Up @@ -125,11 +125,7 @@ impl<'help, 'cmd> Validator<'help, 'cmd> {
let used: Vec<Id> = matcher
.arg_names()
.filter(|arg_id| matcher.check_explicit(arg_id, ArgPredicate::IsPresent))
.filter(|&n| {
self.cmd.find(n).map_or(true, |a| {
!(a.is_hide_set() || self.required.contains(&a.id))
})
})
.filter(|&n| self.cmd.find(n).map_or(true, |a| !a.is_hide_set()))
.cloned()
.collect();
return Err(Error::invalid_value(
Expand Down

0 comments on commit 05aecf8

Please sign in to comment.