Skip to content

Commit

Permalink
Merge pull request #4923 from epage/update
Browse files Browse the repository at this point in the history
chore: Update from '_rust/main' template
  • Loading branch information
epage committed May 19, 2023
2 parents 8edf8c7 + 21d911d commit d597cf7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 6 additions & 4 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
disallowed-methods = [
{ path = "std::option::Option::map_or", reason = "use `map(..).unwrap_or(..)`" },
{ path = "std::option::Option::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
{ path = "std::result::Result::map_or", reason = "use `map(..).unwrap_or(..)`" },
{ path = "std::result::Result::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
{ path = "std::result::Result::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::result::Result::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
{ path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" },
{ path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" },
]
6 changes: 4 additions & 2 deletions clap_builder/src/parser/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ impl<'cmd> Validator<'cmd> {
// Find `arg`s which are exclusive but also appear with other args.
.filter(|&arg| arg.is_exclusive_set() && args_count > 1)
})
// Throw an error for the first conflict found.
.try_for_each(|arg| {
.next()
.map(|arg| {
// Throw an error for the first conflict found.
Err(Error::argument_conflict(
self.cmd,
arg.to_string(),
Expand All @@ -147,6 +148,7 @@ impl<'cmd> Validator<'cmd> {
.create_usage_with_title(&[]),
))
})
.unwrap_or(Ok(()))
}

fn build_conflict_err(
Expand Down
8 changes: 2 additions & 6 deletions tests/derive/skip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,13 @@ fn skip_2() {
fn skip_enum() {
#[derive(Debug, PartialEq)]
#[allow(unused)]
#[derive(Default)]
enum Kind {
A,
#[default]
B,
}

impl Default for Kind {
fn default() -> Self {
Kind::B
}
}

#[derive(Parser, Debug, PartialEq)]
pub struct Opt {
#[arg(long, short)]
Expand Down

0 comments on commit d597cf7

Please sign in to comment.