diff options
Diffstat (limited to 'vendor/clap_derive')
-rw-r--r-- | vendor/clap_derive/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/clap_derive/Cargo.toml | 4 | ||||
-rw-r--r-- | vendor/clap_derive/src/derives/args.rs | 45 | ||||
-rw-r--r-- | vendor/clap_derive/src/derives/into_app.rs | 18 | ||||
-rw-r--r-- | vendor/clap_derive/src/derives/parser.rs | 15 | ||||
-rw-r--r-- | vendor/clap_derive/src/derives/subcommand.rs | 47 | ||||
-rw-r--r-- | vendor/clap_derive/src/derives/value_enum.rs | 9 | ||||
-rw-r--r-- | vendor/clap_derive/src/dummies.rs | 6 | ||||
-rw-r--r-- | vendor/clap_derive/src/item.rs | 12 |
9 files changed, 99 insertions, 59 deletions
diff --git a/vendor/clap_derive/.cargo-checksum.json b/vendor/clap_derive/.cargo-checksum.json index f3a511758..7473991e3 100644 --- a/vendor/clap_derive/.cargo-checksum.json +++ b/vendor/clap_derive/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"551beeba21ed1bf69a26224ca79316d6e8a3569f220c8f17cb16c3f5176b7362","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"425bac05c6433fcda018d78beae9543e4421b2d715a459f5bdef67a927574991","src/attr.rs":"ad973925fdeef693ac1eb31b84f57d4860507e3d39bb00ca2c73b4a362245936","src/derives/args.rs":"6b9631da93550efb9c6b2e1c405dfcf07b35bd604ae3cf3bcf843e4cdbbc388b","src/derives/into_app.rs":"4f1a06bb2e071518585669c058b710afd9130e81ed2c7c6fae792ed0337b8316","src/derives/mod.rs":"ff7947fddee4b3d8365e29459a02458382e13df022aee822e09bce1ac255d3bb","src/derives/parser.rs":"16d208e1d8ef9363841dfcdc11ffd4a35f0451223ceb376f2ac5669a03915f08","src/derives/subcommand.rs":"565b4b40506e7ba2bf16390252ca759fe7205bc11537ed184eef4cc5a16e4b38","src/derives/value_enum.rs":"07b577f5180741c57cc2373ee6cc47714068edd9370c8e4374f56d107e72b07d","src/dummies.rs":"2aba33ec7f7836311d565b95c00b3508ce39df6e2c86415df51070d20f864f6d","src/item.rs":"66788ae124dd1cf98f9f1ecd83214a62ac878906004f0c73d1a151894fe44997","src/lib.rs":"887dec4b7de56101551ef9f7a3b4856ae7764e9ea073c2b935171bd42cb8b4d0","src/macros.rs":"3f60c5673c005548bbcd47f84e1f0fc6d1fb190d467681c3d9c52014bb4c6d36","src/utils/doc_comments.rs":"e986ad438add0684b961d072855cab822765d88aa7268484719e883f3d57ee21","src/utils/error.rs":"ac1ac681e5660044b8ad7420f98ed31ad5cf564f83a3e60673d03fb0e5da13d6","src/utils/mod.rs":"76c2dfb6801155f2354fd752407f2b3a26ec404a45e11a7de02db7b4e664f345","src/utils/spanned.rs":"39f7fb9bda1a2c56c358ab60a23d459fffd913b966b819160fae8ae2f7f20075","src/utils/ty.rs":"c8e9cb8b46e514e3a189dadf1d2c2741ca1469049b2d40b5fa72b83689d37c6f"},"package":"3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"}
\ No newline at end of file +{"files":{"Cargo.toml":"df28ab6d329e9bbf5f801cb95167027c749d4a250e894374bfe663ba6b06e146","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"425bac05c6433fcda018d78beae9543e4421b2d715a459f5bdef67a927574991","src/attr.rs":"ad973925fdeef693ac1eb31b84f57d4860507e3d39bb00ca2c73b4a362245936","src/derives/args.rs":"88cf3c80101b4f93291d6f972582ba6f2bf60d9650b7fbff448122166e7282fd","src/derives/into_app.rs":"fa721689fd8a53e6f7b320644356007cd65fabea689a445e2eaf5e3638e7580a","src/derives/mod.rs":"ff7947fddee4b3d8365e29459a02458382e13df022aee822e09bce1ac255d3bb","src/derives/parser.rs":"a2d4bfbc6b794f9d0c79d3c0228464097135398988a29991f3b8f287e2e5e19f","src/derives/subcommand.rs":"0372e1f5534cd5d55e884981dc1b60b8036f45517e3dd896c401c7c94c3b7349","src/derives/value_enum.rs":"7357f8967c776c9ca98680dc6ee2b4cdbec56fe730d9c4b4582c86ba1f5c5f9e","src/dummies.rs":"71938428ae479a7fa0e9b919434385202bb4f09620a329e4ffc7a742fc0ee706","src/item.rs":"fdbd4a3bb124f92c1b56de5180d553a1980e64b2e0a34d43fdc76662d37c26db","src/lib.rs":"887dec4b7de56101551ef9f7a3b4856ae7764e9ea073c2b935171bd42cb8b4d0","src/macros.rs":"3f60c5673c005548bbcd47f84e1f0fc6d1fb190d467681c3d9c52014bb4c6d36","src/utils/doc_comments.rs":"e986ad438add0684b961d072855cab822765d88aa7268484719e883f3d57ee21","src/utils/error.rs":"ac1ac681e5660044b8ad7420f98ed31ad5cf564f83a3e60673d03fb0e5da13d6","src/utils/mod.rs":"76c2dfb6801155f2354fd752407f2b3a26ec404a45e11a7de02db7b4e664f345","src/utils/spanned.rs":"39f7fb9bda1a2c56c358ab60a23d459fffd913b966b819160fae8ae2f7f20075","src/utils/ty.rs":"c8e9cb8b46e514e3a189dadf1d2c2741ca1469049b2d40b5fa72b83689d37c6f"},"package":"b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"}
\ No newline at end of file diff --git a/vendor/clap_derive/Cargo.toml b/vendor/clap_derive/Cargo.toml index 48793fb3c..a3fe19b53 100644 --- a/vendor/clap_derive/Cargo.toml +++ b/vendor/clap_derive/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.64.0" name = "clap_derive" -version = "4.2.0" +version = "4.3.2" include = [ "build.rs", "src/**/*", @@ -43,8 +43,8 @@ repository = "https://github.com/clap-rs/clap/tree/master/clap_derive" targets = ["x86_64-unknown-linux-gnu"] [package.metadata.release] -shared-version = true dependent-version = "upgrade" +shared-version = true tag-name = "v{{version}}" [lib] diff --git a/vendor/clap_derive/src/derives/args.rs b/vendor/clap_derive/src/derives/args.rs index e8611b6bd..20164ff2e 100644 --- a/vendor/clap_derive/src/derives/args.rs +++ b/vendor/clap_derive/src/derives/args.rs @@ -16,7 +16,7 @@ use proc_macro2::{Ident, Span, TokenStream}; use quote::{format_ident, quote, quote_spanned}; use syn::{ punctuated::Punctuated, spanned::Spanned, token::Comma, Data, DataStruct, DeriveInput, Field, - Fields, Generics, + Fields, FieldsNamed, Generics, }; use crate::item::{Item, Kind, Name}; @@ -32,14 +32,7 @@ pub fn derive_args(input: &DeriveInput) -> Result<TokenStream, syn::Error> { }) => { let name = Name::Derived(ident.clone()); let item = Item::from_args_struct(input, name)?; - let fields = fields - .named - .iter() - .map(|field| { - let item = Item::from_args_field(field, item.casing(), item.env_casing())?; - Ok((field, item)) - }) - .collect::<Result<Vec<_>, syn::Error>>()?; + let fields = collect_args_fields(&item, fields)?; gen_for_struct(&item, ident, &input.generics, &fields) } Data::Struct(DataStruct { @@ -93,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, @@ -106,6 +105,7 @@ pub fn gen_for_struct( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::FromArgMatches for #item_name #ty_generics #where_clause { fn from_arg_matches(__clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> { Self::from_arg_matches_mut(&mut __clap_arg_matches.clone()) @@ -128,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, @@ -141,6 +147,7 @@ pub fn gen_for_struct( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::Args for #item_name #ty_generics #where_clause { fn group_id() -> Option<clap::Id> { #group_id @@ -710,7 +717,7 @@ fn gen_parsers( Ty::Other => { quote_spanned! { ty.span()=> #arg_matches.#get_one(#id) - .ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, format!("The following required argument was not provided: {}", #id)))? + .ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, concat!("The following required argument was not provided: ", #id)))? } } }; @@ -740,3 +747,17 @@ pub fn raw_deprecated() -> TokenStream { } } + +pub fn collect_args_fields<'a>( + item: &'a Item, + fields: &'a FieldsNamed, +) -> Result<Vec<(&'a Field, Item)>, syn::Error> { + fields + .named + .iter() + .map(|field| { + let item = Item::from_args_field(field, item.casing(), item.env_casing())?; + Ok((field, item)) + }) + .collect() +} diff --git a/vendor/clap_derive/src/derives/into_app.rs b/vendor/clap_derive/src/derives/into_app.rs index 72f081fd8..0bd636245 100644 --- a/vendor/clap_derive/src/derives/into_app.rs +++ b/vendor/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, @@ -42,6 +48,7 @@ pub fn gen_for_struct( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::CommandFactory for #item_name #ty_generics #where_clause { fn command<'b>() -> clap::Command { let #app_var = clap::Command::new(#name); @@ -69,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, @@ -82,6 +95,7 @@ pub fn gen_for_enum( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::CommandFactory for #item_name #ty_generics #where_clause { fn command<'b>() -> clap::Command { let #app_var = clap::Command::new(#name) diff --git a/vendor/clap_derive/src/derives/parser.rs b/vendor/clap_derive/src/derives/parser.rs index 39b0b8a77..272948b63 100644 --- a/vendor/clap_derive/src/derives/parser.rs +++ b/vendor/clap_derive/src/derives/parser.rs @@ -21,6 +21,7 @@ use syn::{ Generics, }; +use crate::derives::args::collect_args_fields; use crate::derives::{args, into_app, subcommand}; use crate::item::Item; use crate::item::Name; @@ -36,14 +37,7 @@ pub fn derive_parser(input: &DeriveInput) -> Result<TokenStream, syn::Error> { }) => { let name = Name::Assigned(quote!(#pkg_name)); let item = Item::from_args_struct(input, name)?; - let fields = fields - .named - .iter() - .map(|field| { - let item = Item::from_args_field(field, item.casing(), item.env_casing())?; - Ok((field, item)) - }) - .collect::<Result<Vec<_>, syn::Error>>()?; + let fields = collect_args_fields(&item, fields)?; gen_for_struct(&item, ident, &input.generics, &fields) } Data::Struct(DataStruct { @@ -92,6 +86,10 @@ fn gen_for_struct( let args = args::gen_for_struct(item, item_name, generics, fields)?; Ok(quote! { + #[automatically_derived] + #[allow( + unused_qualifications, + )] impl #impl_generics clap::Parser for #item_name #ty_generics #where_clause {} #into_app @@ -111,6 +109,7 @@ fn gen_for_enum( let subcommand = subcommand::gen_for_enum(item, item_name, generics, variants)?; Ok(quote! { + #[automatically_derived] impl #impl_generics clap::Parser for #item_name #ty_generics #where_clause {} #into_app diff --git a/vendor/clap_derive/src/derives/subcommand.rs b/vendor/clap_derive/src/derives/subcommand.rs index 403fe4557..3ae74d01a 100644 --- a/vendor/clap_derive/src/derives/subcommand.rs +++ b/vendor/clap_derive/src/derives/subcommand.rs @@ -17,6 +17,7 @@ use quote::{format_ident, quote, quote_spanned}; use syn::{spanned::Spanned, Data, DeriveInput, FieldsUnnamed, Generics, Variant}; use crate::derives::args; +use crate::derives::args::collect_args_fields; use crate::item::{Item, Kind, Name}; use crate::utils::{is_simple_ty, subty_if_name}; @@ -65,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, @@ -78,6 +85,7 @@ pub fn gen_for_enum( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::FromArgMatches for #item_name #ty_generics #where_clause { fn from_arg_matches(__clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> { Self::from_arg_matches_mut(&mut __clap_arg_matches.clone()) @@ -91,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, @@ -104,6 +118,7 @@ pub fn gen_for_enum( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl #impl_generics clap::Subcommand for #item_name #ty_generics #where_clause { fn augment_subcommands <'b>(__clap_app: clap::Command) -> clap::Command { #augmentation @@ -264,15 +279,7 @@ fn gen_augment( let sub_augment = match variant.fields { Named(ref fields) => { // Defer to `gen_augment` for adding cmd methods - let fields = fields - .named - .iter() - .map(|field| { - let item = - Item::from_args_field(field, item.casing(), item.env_casing())?; - Ok((field, item)) - }) - .collect::<Result<Vec<_>, syn::Error>>()?; + let fields = collect_args_fields(item, fields)?; args::gen_augment(&fields, &subcommand_var, item, override_required)? } Unit => { @@ -484,14 +491,7 @@ fn gen_from_arg_matches(variants: &[(&Variant, Item)]) -> Result<TokenStream, sy let variant_name = &variant.ident; let constructor_block = match variant.fields { Named(ref fields) => { - let fields = fields - .named - .iter() - .map(|field| { - let item = Item::from_args_field(field, item.casing(), item.env_casing())?; - Ok((field, item)) - }) - .collect::<Result<Vec<_>, syn::Error>>()?; + let fields = collect_args_fields(item, fields)?; args::gen_constructor(&fields)? }, Unit => quote!(), @@ -599,14 +599,7 @@ fn gen_update_from_arg_matches(variants: &[(&Variant, Item)]) -> Result<TokenStr let field_names = fields.named.iter().map(|field| { field.ident.as_ref().unwrap() }).collect::<Vec<_>>(); - let fields = fields - .named - .iter() - .map(|field| { - let item = Item::from_args_field(field, item.casing(), item.env_casing())?; - Ok((field, item)) - }) - .collect::<Result<Vec<_>, syn::Error>>()?; + let fields = collect_args_fields(item, fields)?; let update = args::gen_updater(&fields, false)?; (quote!( { #( #field_names, )* }), quote!( { #update } )) } diff --git a/vendor/clap_derive/src/derives/value_enum.rs b/vendor/clap_derive/src/derives/value_enum.rs index 6f107c01c..397eb3323 100644 --- a/vendor/clap_derive/src/derives/value_enum.rs +++ b/vendor/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, @@ -64,6 +70,7 @@ pub fn gen_for_enum( clippy::suspicious_else_formatting, clippy::almost_swapped, )] + #[automatically_derived] impl clap::ValueEnum for #item_name { #value_variants #to_possible_value diff --git a/vendor/clap_derive/src/dummies.rs b/vendor/clap_derive/src/dummies.rs index b10bedc64..3a1581b23 100644 --- a/vendor/clap_derive/src/dummies.rs +++ b/vendor/clap_derive/src/dummies.rs @@ -7,6 +7,7 @@ use quote::quote; pub fn parser(name: &Ident) -> proc_macro2::TokenStream { let into_app = into_app(name); quote!( + #[automatically_derived] impl clap::Parser for #name {} #into_app ) @@ -15,6 +16,7 @@ pub fn parser(name: &Ident) -> proc_macro2::TokenStream { #[must_use] pub fn into_app(name: &Ident) -> proc_macro2::TokenStream { quote! { + #[automatically_derived] impl clap::CommandFactory for #name { fn command<'b>() -> clap::Command { unimplemented!() @@ -29,6 +31,7 @@ pub fn into_app(name: &Ident) -> proc_macro2::TokenStream { #[must_use] pub fn from_arg_matches(name: &Ident) -> proc_macro2::TokenStream { quote! { + #[automatically_derived] impl clap::FromArgMatches for #name { fn from_arg_matches(_m: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> { unimplemented!() @@ -44,6 +47,7 @@ pub fn from_arg_matches(name: &Ident) -> proc_macro2::TokenStream { pub fn subcommand(name: &Ident) -> proc_macro2::TokenStream { let from_arg_matches = from_arg_matches(name); quote! { + #[automatically_derived] impl clap::Subcommand for #name { fn augment_subcommands(_cmd: clap::Command) -> clap::Command { unimplemented!() @@ -63,6 +67,7 @@ pub fn subcommand(name: &Ident) -> proc_macro2::TokenStream { pub fn args(name: &Ident) -> proc_macro2::TokenStream { let from_arg_matches = from_arg_matches(name); quote! { + #[automatically_derived] impl clap::Args for #name { fn augment_args(_cmd: clap::Command) -> clap::Command { unimplemented!() @@ -78,6 +83,7 @@ pub fn args(name: &Ident) -> proc_macro2::TokenStream { #[must_use] pub fn value_enum(name: &Ident) -> proc_macro2::TokenStream { quote! { + #[automatically_derived] impl clap::ValueEnum for #name { fn value_variants<'a>() -> &'a [Self]{ unimplemented!() diff --git a/vendor/clap_derive/src/item.rs b/vendor/clap_derive/src/item.rs index 9b29ff9e8..f3631fa7f 100644 --- a/vendor/clap_derive/src/item.rs +++ b/vendor/clap_derive/src/item.rs @@ -908,7 +908,7 @@ impl Item { if !lines.is_empty() { let (short_help, long_help) = format_doc_comment(&lines, !self.verbatim_doc_comment, self.force_long_help); - let short_name = format_ident!("{}", short_name); + let short_name = format_ident!("{short_name}"); let short = Method::new( short_name, short_help @@ -917,7 +917,7 @@ impl Item { ); self.doc_comment.push(short); if let Some(long_name) = long_name { - let long_name = format_ident!("{}", long_name); + let long_name = format_ident!("{long_name}"); let long = Method::new( long_name, long_help @@ -946,7 +946,7 @@ impl Item { (_, _) => { let old = self.kind.name(); let new = kind.name(); - abort!(kind.span(), "`{}` cannot be used with `{}`", new, old); + abort!(kind.span(), "`{new}` cannot be used with `{old}`"); } } Ok(()) @@ -1247,8 +1247,8 @@ impl Method { ident, "cannot derive `{}` from Cargo.toml\n\n= note: {note}\n\n= help: {help}\n\n", ident, - note = format_args!("`{}` environment variable is not set", env_var), - help = format_args!("use `{} = \"...\"` to set {} manually", ident, ident) + note = format_args!("`{env_var}` environment variable is not set"), + help = format_args!("use `{ident} = \"...\"` to set {ident} manually") ); } }; @@ -1405,7 +1405,7 @@ impl CasingStyle { "lower" | "lowercase" => cs(Lower), "upper" | "uppercase" => cs(Upper), "verbatim" | "verbatimcase" => cs(Verbatim), - s => abort!(name, "unsupported casing: `{}`", s), + s => abort!(name, "unsupported casing: `{s}`"), }; Ok(s) } |