From 9167fdebf306c8fcad1134d4db2a95f493c4bc9a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 12 Nov 2021 12:52:18 -0600 Subject: [PATCH] fix(derive): Don't emit warnings 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 #3017 --- clap_derive/src/derives/arg_enum.rs | 3 ++- clap_derive/src/derives/args.rs | 6 ++++-- clap_derive/src/derives/into_app.rs | 6 ++++-- clap_derive/src/derives/subcommand.rs | 6 ++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/clap_derive/src/derives/arg_enum.rs b/clap_derive/src/derives/arg_enum.rs index e27a02199b3..61f998212f8 100644 --- a/clap_derive/src/derives/arg_enum.rs +++ b/clap_derive/src/derives/arg_enum.rs @@ -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 { diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs index 6f7a0e6e699..4a80b7f4c4c 100644 --- a/clap_derive/src/derives/args.rs +++ b/clap_derive/src/derives/args.rs @@ -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 { @@ -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 { diff --git a/clap_derive/src/derives/into_app.rs b/clap_derive/src/derives/into_app.rs index d5d0192fd44..86160ab82c2 100644 --- a/clap_derive/src/derives/into_app.rs +++ b/clap_derive/src/derives/into_app.rs @@ -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 { @@ -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 { diff --git a/clap_derive/src/derives/subcommand.rs b/clap_derive/src/derives/subcommand.rs index e64d764e42b..989bc51e7ff 100644 --- a/clap_derive/src/derives/subcommand.rs +++ b/clap_derive/src/derives/subcommand.rs @@ -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 { @@ -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 {