mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
parent
5661b6b508
commit
103ae5cf62
6 changed files with 66 additions and 7 deletions
|
@ -86,7 +86,13 @@ pub fn gen_for_struct(
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
|
#[allow(
|
||||||
|
dead_code,
|
||||||
|
unreachable_code,
|
||||||
|
unused_variables,
|
||||||
|
unused_braces,
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
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(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
|
|
@ -29,7 +29,13 @@ pub fn gen_for_struct(
|
||||||
let app_var = Ident::new("__clap_app", Span::call_site());
|
let app_var = Ident::new("__clap_app", Span::call_site());
|
||||||
|
|
||||||
let tokens = quote! {
|
let tokens = quote! {
|
||||||
#[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
|
#[allow(
|
||||||
|
dead_code,
|
||||||
|
unreachable_code,
|
||||||
|
unused_variables,
|
||||||
|
unused_braces,
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
@ -70,7 +76,13 @@ pub fn gen_for_enum(
|
||||||
let app_var = Ident::new("__clap_app", Span::call_site());
|
let app_var = Ident::new("__clap_app", Span::call_site());
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
|
#[allow(
|
||||||
|
dead_code,
|
||||||
|
unreachable_code,
|
||||||
|
unused_variables,
|
||||||
|
unused_braces,
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
|
|
@ -87,6 +87,9 @@ fn gen_for_struct(
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
|
#[allow(
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
impl #impl_generics clap::Parser for #item_name #ty_generics #where_clause {}
|
impl #impl_generics clap::Parser for #item_name #ty_generics #where_clause {}
|
||||||
|
|
||||||
#into_app
|
#into_app
|
||||||
|
|
|
@ -66,7 +66,13 @@ pub fn gen_for_enum(
|
||||||
let has_subcommand = gen_has_subcommand(variants)?;
|
let has_subcommand = gen_has_subcommand(variants)?;
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
|
#[allow(
|
||||||
|
dead_code,
|
||||||
|
unreachable_code,
|
||||||
|
unused_variables,
|
||||||
|
unused_braces,
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
@ -93,7 +99,13 @@ pub fn gen_for_enum(
|
||||||
#update_from_arg_matches
|
#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(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
|
|
@ -51,7 +51,13 @@ pub fn gen_for_enum(
|
||||||
let to_possible_value = gen_to_possible_value(item, &lits);
|
let to_possible_value = gen_to_possible_value(item, &lits);
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
|
#[allow(
|
||||||
|
dead_code,
|
||||||
|
unreachable_code,
|
||||||
|
unused_variables,
|
||||||
|
unused_braces,
|
||||||
|
unused_qualifications,
|
||||||
|
)]
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::style,
|
clippy::style,
|
||||||
clippy::complexity,
|
clippy::complexity,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
|
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
|
||||||
// MIT/Apache 2.0 license.
|
// MIT/Apache 2.0 license.
|
||||||
|
|
||||||
|
#![deny(unused_qualifications)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
@ -51,3 +52,16 @@ fn warning_never_enum() {
|
||||||
Opt::try_parse_from(["test", "foo", "foo"]).unwrap()
|
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<L: Args> {
|
||||||
|
#[command(flatten)]
|
||||||
|
pub left: L,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue