diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs index 5313c1db..ab2babb0 100644 --- a/clap_derive/src/derives/args.rs +++ b/clap_derive/src/derives/args.rs @@ -202,7 +202,7 @@ pub fn gen_augment( let kind = item.kind(); match &*kind { Kind::Command(_) - | Kind::Value(_) + | Kind::Value | Kind::Subcommand(_) | Kind::Skip(_, _) | Kind::FromGlobal(_) @@ -346,7 +346,7 @@ pub fn gen_constructor(fields: &[(&Field, Item)]) -> TokenStream { let arg_matches = format_ident!("__clap_arg_matches"); match &*kind { Kind::Command(_) - | Kind::Value(_) + | Kind::Value | Kind::ExternalSubcommand => { abort! { kind.span(), "`{}` cannot be used with `arg`", @@ -417,7 +417,7 @@ pub fn gen_updater(fields: &[(&Field, Item)], use_self: bool) -> TokenStream { match &*kind { Kind::Command(_) - | Kind::Value(_) + | Kind::Value | Kind::ExternalSubcommand => { abort! { kind.span(), "`{}` cannot be used with `arg`", diff --git a/clap_derive/src/derives/value_enum.rs b/clap_derive/src/derives/value_enum.rs index c3184c03..e724129b 100644 --- a/clap_derive/src/derives/value_enum.rs +++ b/clap_derive/src/derives/value_enum.rs @@ -42,7 +42,7 @@ pub fn derive_value_enum(input: &DeriveInput) -> TokenStream { } pub fn gen_for_enum(item: &Item, item_name: &Ident, variants: &[(&Variant, Item)]) -> TokenStream { - if !matches!(&*item.kind(), Kind::Value(_)) { + if !matches!(&*item.kind(), Kind::Value) { abort! { item.kind().span(), "`{}` cannot be used with `value`", item.kind().name(), diff --git a/clap_derive/src/item.rs b/clap_derive/src/item.rs index 812b43e8..f0d029d6 100644 --- a/clap_derive/src/item.rs +++ b/clap_derive/src/item.rs @@ -76,7 +76,7 @@ impl Item { let attrs = &input.attrs; let argument_casing = Sp::call_site(DEFAULT_CASING); let env_casing = Sp::call_site(DEFAULT_ENV_CASING); - let kind = Sp::new(Kind::Value(Sp::new(Ty::Other, span)), span); + let kind = Sp::new(Kind::Value, span); Self::from_struct(attrs, name, argument_casing, env_casing, kind) } @@ -165,7 +165,7 @@ impl Item { | Kind::FromGlobal(_) | Kind::Skip(_, _) | Kind::Command(_) - | Kind::Value(_) + | Kind::Value | Kind::Arg(_) => (), } @@ -178,7 +178,7 @@ impl Item { env_casing: Sp, ) -> Self { let span = variant.span(); - let kind = Sp::new(Kind::Value(Sp::new(Ty::Other, span)), span); + let kind = Sp::new(Kind::Value, span); let mut res = Self::new( Name::Derived(variant.ident.clone()), None, @@ -304,7 +304,7 @@ impl Item { ); } - Kind::Command(_) | Kind::Value(_) | Kind::ExternalSubcommand => {} + Kind::Command(_) | Kind::Value | Kind::ExternalSubcommand => {} } res @@ -888,7 +888,7 @@ impl Item { | (Kind::Command(_), Kind::Flatten) | (Kind::Command(_), Kind::Skip(_, _)) | (Kind::Command(_), Kind::ExternalSubcommand) - | (Kind::Value(_), Kind::Skip(_, _)) => { + | (Kind::Value, Kind::Skip(_, _)) => { self.kind = kind; } @@ -1128,7 +1128,7 @@ fn default_action(field_type: &Type, span: Span) -> Method { pub enum Kind { Arg(Sp), Command(Sp), - Value(Sp), + Value, FromGlobal(Sp), Subcommand(Sp), Flatten, @@ -1141,7 +1141,7 @@ impl Kind { match self { Self::Arg(_) => "arg", Self::Command(_) => "command", - Self::Value(_) => "value", + Self::Value => "value", Self::FromGlobal(_) => "from_global", Self::Subcommand(_) => "subcommand", Self::Flatten => "flatten", @@ -1154,7 +1154,7 @@ impl Kind { match self { Self::Arg(_) => AttrKind::Arg, Self::Command(_) => AttrKind::Command, - Self::Value(_) => AttrKind::Value, + Self::Value => AttrKind::Value, Self::FromGlobal(_) => AttrKind::Arg, Self::Subcommand(_) => AttrKind::Command, Self::Flatten => AttrKind::Command,