diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs index 5d587950..20164ff2 100644 --- a/clap_derive/src/derives/args.rs +++ b/clap_derive/src/derives/args.rs @@ -86,7 +86,13 @@ pub fn gen_for_struct( }; Ok(quote! { - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, @@ -122,7 +128,13 @@ pub fn gen_for_struct( } } - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, diff --git a/clap_derive/src/derives/into_app.rs b/clap_derive/src/derives/into_app.rs index 71eb59f5..0bd63624 100644 --- a/clap_derive/src/derives/into_app.rs +++ b/clap_derive/src/derives/into_app.rs @@ -29,7 +29,13 @@ pub fn gen_for_struct( let app_var = Ident::new("__clap_app", Span::call_site()); let tokens = quote! { - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, @@ -70,7 +76,13 @@ pub fn gen_for_enum( let app_var = Ident::new("__clap_app", Span::call_site()); Ok(quote! { - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, diff --git a/clap_derive/src/derives/parser.rs b/clap_derive/src/derives/parser.rs index 605ae190..272948b6 100644 --- a/clap_derive/src/derives/parser.rs +++ b/clap_derive/src/derives/parser.rs @@ -87,6 +87,9 @@ fn gen_for_struct( Ok(quote! { #[automatically_derived] + #[allow( + unused_qualifications, + )] impl #impl_generics clap::Parser for #item_name #ty_generics #where_clause {} #into_app diff --git a/clap_derive/src/derives/subcommand.rs b/clap_derive/src/derives/subcommand.rs index 51450d24..3ae74d01 100644 --- a/clap_derive/src/derives/subcommand.rs +++ b/clap_derive/src/derives/subcommand.rs @@ -66,7 +66,13 @@ pub fn gen_for_enum( let has_subcommand = gen_has_subcommand(variants)?; Ok(quote! { - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, @@ -93,7 +99,13 @@ pub fn gen_for_enum( #update_from_arg_matches } - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, diff --git a/clap_derive/src/derives/value_enum.rs b/clap_derive/src/derives/value_enum.rs index b7d8c2f8..397eb332 100644 --- a/clap_derive/src/derives/value_enum.rs +++ b/clap_derive/src/derives/value_enum.rs @@ -51,7 +51,13 @@ pub fn gen_for_enum( let to_possible_value = gen_to_possible_value(item, &lits); Ok(quote! { - #[allow(dead_code, unreachable_code, unused_variables, unused_braces)] + #[allow( + dead_code, + unreachable_code, + unused_variables, + unused_braces, + unused_qualifications, + )] #[allow( clippy::style, clippy::complexity, diff --git a/tests/derive/deny_warnings.rs b/tests/derive/deny_warnings.rs index 1b3fea26..086733c1 100644 --- a/tests/derive/deny_warnings.rs +++ b/tests/derive/deny_warnings.rs @@ -12,6 +12,7 @@ // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // MIT/Apache 2.0 license. +#![deny(unused_qualifications)] #![deny(warnings)] use clap::Parser; @@ -51,3 +52,16 @@ fn warning_never_enum() { Opt::try_parse_from(["test", "foo", "foo"]).unwrap() ); } + +#[test] +fn warning_unused_qualifications() { + // This causes `clap::Args` within the derive to be unused qualifications + use clap::Args; + + #[derive(Args, Clone, Copy, Debug, Default)] + #[group(skip)] + pub struct Compose { + #[command(flatten)] + pub left: L, + } +}