Skip to content

Commit

Permalink
fix(derive): Don't emit warnings
Browse files Browse the repository at this point in the history
Looks like this is coming from `update_from_arg_matches` where we do a
ladder of `if __clap_arg_matches.is_present(...)` that clippy wants to
be `else if`s.  While for human edited code, that does clarify intent,
for machine generated code that is rarely read, its a pain to do, so
silencing it.

Unfortunately, it isn't in a group we can overall silence.

Fixes clap-rs#3017
  • Loading branch information
epage committed Nov 12, 2021
1 parent 98c1a75 commit 9167fde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion clap_derive/src/derives/arg_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ pub fn gen_for_enum(name: &Ident, attrs: &[Attribute], e: &DataEnum) -> TokenStr
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::ArgEnum for #name {
Expand Down
6 changes: 4 additions & 2 deletions clap_derive/src/derives/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ pub fn gen_for_struct(
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::Args for #struct_name {
Expand Down Expand Up @@ -114,7 +115,8 @@ pub fn gen_from_arg_matches_for_struct(
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::FromArgMatches for #struct_name {
Expand Down
6 changes: 4 additions & 2 deletions clap_derive/src/derives/into_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ pub fn gen_for_struct(struct_name: &Ident, attrs: &[Attribute]) -> TokenStream {
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::IntoApp for #struct_name {
Expand Down Expand Up @@ -109,7 +110,8 @@ pub fn gen_for_enum(enum_name: &Ident, attrs: &[Attribute]) -> TokenStream {
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::IntoApp for #enum_name {
Expand Down
6 changes: 4 additions & 2 deletions clap_derive/src/derives/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ pub fn gen_for_enum(enum_name: &Ident, attrs: &[Attribute], e: &DataEnum) -> Tok
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::Subcommand for #enum_name {
Expand Down Expand Up @@ -102,7 +103,8 @@ fn gen_from_arg_matches_for_enum(name: &Ident, attrs: &[Attribute], e: &DataEnum
clippy::perf,
clippy::deprecated,
clippy::nursery,
clippy::cargo
clippy::cargo,
clippy::suspicious_else_formatting,
)]
#[deny(clippy::correctness)]
impl clap::FromArgMatches for #name {
Expand Down

0 comments on commit 9167fde

Please sign in to comment.