diff --git a/CHANGELOG.md b/CHANGELOG.md index a3320b79366..caf2114008b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 5.0.0 - Upcoming + +### Breaking Changes + +- *(derive)* Removed `#[clap(value_parser)]` and `#[clap(action)]` defaulted attributes (its the default) (#3976) + ## 4.0.0 - Upcoming ### Breaking Changes diff --git a/clap_complete/examples/completion-derive.rs b/clap_complete/examples/completion-derive.rs index fb2e95dd78e..b988aca0f16 100644 --- a/clap_complete/examples/completion-derive.rs +++ b/clap_complete/examples/completion-derive.rs @@ -26,34 +26,34 @@ use std::path::PathBuf; )] struct Opt { /// If provided, outputs the completion file for given shell - #[clap(long = "generate", arg_enum, value_parser)] + #[clap(long = "generate", arg_enum)] generator: Option, // Showcasing all possible ValueHints: - #[clap(long, value_hint = ValueHint::Unknown, value_parser)] + #[clap(long, value_hint = ValueHint::Unknown)] unknown: Option, - #[clap(long, value_hint = ValueHint::Other, value_parser)] + #[clap(long, value_hint = ValueHint::Other)] other: Option, - #[clap(short, long, value_hint = ValueHint::AnyPath, value_parser)] + #[clap(short, long, value_hint = ValueHint::AnyPath)] path: Option, - #[clap(short, long, value_hint = ValueHint::FilePath, value_parser)] + #[clap(short, long, value_hint = ValueHint::FilePath)] file: Option, - #[clap(short, long, value_hint = ValueHint::DirPath, value_parser)] + #[clap(short, long, value_hint = ValueHint::DirPath)] dir: Option, - #[clap(short, long, value_hint = ValueHint::ExecutablePath, value_parser)] + #[clap(short, long, value_hint = ValueHint::ExecutablePath)] exe: Option, - #[clap(long, value_hint = ValueHint::CommandName, value_parser)] + #[clap(long, value_hint = ValueHint::CommandName)] cmd_name: Option, - #[clap(short, long, value_hint = ValueHint::CommandString, value_parser)] + #[clap(short, long, value_hint = ValueHint::CommandString)] cmd: Option, - #[clap(value_hint = ValueHint::CommandWithArguments, value_parser)] + #[clap(value_hint = ValueHint::CommandWithArguments)] command_with_args: Vec, - #[clap(short, long, value_hint = ValueHint::Username, value_parser)] + #[clap(short, long, value_hint = ValueHint::Username)] user: Option, - #[clap(short, long, value_hint = ValueHint::Hostname, value_parser)] + #[clap(short, long, value_hint = ValueHint::Hostname)] host: Option, - #[clap(long, value_hint = ValueHint::Url, value_parser)] + #[clap(long, value_hint = ValueHint::Url)] url: Option, - #[clap(long, value_hint = ValueHint::EmailAddress, value_parser)] + #[clap(long, value_hint = ValueHint::EmailAddress)] email: Option, } diff --git a/clap_complete/src/dynamic.rs b/clap_complete/src/dynamic.rs index c937d4cb4e2..e8f4d584729 100644 --- a/clap_complete/src/dynamic.rs +++ b/clap_complete/src/dynamic.rs @@ -22,7 +22,7 @@ pub mod bash { #[derive(Clone, Debug)] pub struct CompleteArgs { /// Path to write completion-registration to - #[clap(long, required = true, value_parser)] + #[clap(long, required = true)] register: Option, #[clap( @@ -30,36 +30,33 @@ pub mod bash { required = true, value_name = "COMP_CWORD", hide_short_help = true, - group = "complete", - value_parser + group = "complete" )] index: Option, - #[clap(long, hide_short_help = true, group = "complete", value_parser)] + #[clap(long, hide_short_help = true, group = "complete")] ifs: Option, #[clap( long = "type", required = true, hide_short_help = true, - group = "complete", - value_parser + group = "complete" )] comp_type: Option, - #[clap(long, hide_short_help = true, group = "complete", action)] + #[clap(long, hide_short_help = true, group = "complete")] space: bool, #[clap( long, conflicts_with = "space", hide_short_help = true, - group = "complete", - action + group = "complete" )] no_space: bool, - #[clap(raw = true, hide_short_help = true, group = "complete", value_parser)] + #[clap(raw = true, hide_short_help = true, group = "complete")] comp_words: Vec, } diff --git a/clap_derive/src/attrs.rs b/clap_derive/src/attrs.rs index 0155fccf3a9..7e8b246f395 100644 --- a/clap_derive/src/attrs.rs +++ b/clap_derive/src/attrs.rs @@ -429,11 +429,13 @@ impl Attrs { self.push_method(ident, self.name.clone().translate(*self.casing)); } + #[cfg(not(feature = "unstable-v5"))] ValueParser(ident) => { use crate::attrs::ValueParser; self.value_parser = Some(ValueParser::Implicit(ident)); } + #[cfg(not(feature = "unstable-v5"))] Action(ident) => { use crate::attrs::Action; self.action = Some(Action::Implicit(ident)); diff --git a/clap_derive/src/parse.rs b/clap_derive/src/parse.rs index 9860f4a1fec..a194a1ba196 100644 --- a/clap_derive/src/parse.rs +++ b/clap_derive/src/parse.rs @@ -25,7 +25,9 @@ pub enum ClapAttr { // single-identifier attributes Short(Ident), Long(Ident), + #[cfg(not(feature = "unstable-v5"))] ValueParser(Ident), + #[cfg(not(feature = "unstable-v5"))] Action(Ident), Env(Ident), Flatten(Ident), @@ -143,7 +145,9 @@ impl Parse for ClapAttr { match name_str.as_ref() { "long" => Ok(Long(name)), "short" => Ok(Short(name)), + #[cfg(not(feature = "unstable-v5"))] "value_parser" => Ok(ValueParser(name)), + #[cfg(not(feature = "unstable-v5"))] "action" => Ok(Action(name)), "env" => Ok(Env(name)), "flatten" => Ok(Flatten(name)), diff --git a/examples/cargo-example-derive.rs b/examples/cargo-example-derive.rs index f0aad29c764..a9cfcb36203 100644 --- a/examples/cargo-example-derive.rs +++ b/examples/cargo-example-derive.rs @@ -10,7 +10,7 @@ enum Cargo { #[derive(clap::Args)] #[clap(author, version, about, long_about = None)] struct ExampleDerive { - #[clap(long, value_parser)] + #[clap(long)] manifest_path: Option, } diff --git a/examples/demo.rs b/examples/demo.rs index a7cecfb0cc1..9d025ef24c3 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -5,11 +5,11 @@ use clap::Parser; #[clap(author, version, about, long_about = None)] struct Args { /// Name of the person to greet - #[clap(short, long, value_parser)] + #[clap(short, long)] name: String, /// Number of times to greet - #[clap(short, long, value_parser, default_value_t = 1)] + #[clap(short, long, default_value_t = 1)] count: u8, } diff --git a/examples/derive_ref/augment_args.rs b/examples/derive_ref/augment_args.rs index 8a07f6743c5..1f10a0b3e2c 100644 --- a/examples/derive_ref/augment_args.rs +++ b/examples/derive_ref/augment_args.rs @@ -2,7 +2,7 @@ use clap::{arg, Args, Command, FromArgMatches as _}; #[derive(Args, Debug)] struct DerivedArgs { - #[clap(short, long, action)] + #[clap(short, long)] derived: bool, } diff --git a/examples/derive_ref/augment_subcommands.rs b/examples/derive_ref/augment_subcommands.rs index 199da98b48d..299c7f8cf69 100644 --- a/examples/derive_ref/augment_subcommands.rs +++ b/examples/derive_ref/augment_subcommands.rs @@ -3,7 +3,7 @@ use clap::{Command, FromArgMatches as _, Parser, Subcommand as _}; #[derive(Parser, Debug)] enum Subcommands { Derived { - #[clap(short, long, action)] + #[clap(short, long)] derived_flag: bool, }, } diff --git a/examples/derive_ref/flatten_hand_args.rs b/examples/derive_ref/flatten_hand_args.rs index 74d10edec5f..faa7c0bbd51 100644 --- a/examples/derive_ref/flatten_hand_args.rs +++ b/examples/derive_ref/flatten_hand_args.rs @@ -69,7 +69,7 @@ impl Args for CliArgs { #[derive(Parser, Debug)] struct Cli { - #[clap(short, long, action)] + #[clap(short, long)] top_level: bool, #[clap(flatten)] more_args: CliArgs, diff --git a/examples/derive_ref/hand_subcommand.rs b/examples/derive_ref/hand_subcommand.rs index e5d9ea9c24a..876e68e2aa3 100644 --- a/examples/derive_ref/hand_subcommand.rs +++ b/examples/derive_ref/hand_subcommand.rs @@ -3,14 +3,12 @@ use clap::{ArgMatches, Args as _, Command, FromArgMatches, Parser, Subcommand}; #[derive(Parser, Debug)] struct AddArgs { - #[clap(value_parser)] name: Vec, } #[derive(Parser, Debug)] struct RemoveArgs { - #[clap(short, long, action)] + #[clap(short, long)] force: bool, - #[clap(value_parser)] name: Vec, } @@ -69,7 +67,7 @@ impl Subcommand for CliSub { #[derive(Parser, Debug)] struct Cli { - #[clap(short, long, action)] + #[clap(short, long)] top_level: bool, #[clap(subcommand)] subcommand: CliSub, diff --git a/examples/escaped-positional-derive.rs b/examples/escaped-positional-derive.rs index fd8fde4ed25..de7b1e9f8b4 100644 --- a/examples/escaped-positional-derive.rs +++ b/examples/escaped-positional-derive.rs @@ -3,13 +3,13 @@ use clap::Parser; #[derive(Parser)] // requires `derive` feature #[clap(author, version, about, long_about = None)] struct Cli { - #[clap(short = 'f', action)] + #[clap(short = 'f')] eff: bool, - #[clap(short = 'p', value_name = "PEAR", value_parser)] + #[clap(short = 'p', value_name = "PEAR")] pea: Option, - #[clap(last = true, value_parser)] + #[clap(last = true)] slop: Vec, } diff --git a/examples/git-derive.rs b/examples/git-derive.rs index ac500ddad08..80bdea79f39 100644 --- a/examples/git-derive.rs +++ b/examples/git-derive.rs @@ -18,21 +18,19 @@ enum Commands { #[clap(arg_required_else_help = true)] Clone { /// The remote to clone - #[clap(value_parser)] remote: String, }, /// pushes things #[clap(arg_required_else_help = true)] Push { /// The remote to target - #[clap(value_parser)] remote: String, }, /// adds things #[clap(arg_required_else_help = true)] Add { /// Stuff to add - #[clap(required = true, value_parser)] + #[clap(required = true)] path: Vec, }, Stash(Stash), @@ -53,19 +51,13 @@ struct Stash { #[derive(Debug, Subcommand)] enum StashCommands { Push(StashPush), - Pop { - #[clap(value_parser)] - stash: Option, - }, - Apply { - #[clap(value_parser)] - stash: Option, - }, + Pop { stash: Option }, + Apply { stash: Option }, } #[derive(Debug, Args)] struct StashPush { - #[clap(short, long, value_parser)] + #[clap(short, long)] message: Option, } diff --git a/examples/tutorial_derive/01_quick.rs b/examples/tutorial_derive/01_quick.rs index 2c20310617c..0e12b8684fb 100644 --- a/examples/tutorial_derive/01_quick.rs +++ b/examples/tutorial_derive/01_quick.rs @@ -6,11 +6,10 @@ use clap::{Parser, Subcommand}; #[clap(author, version, about, long_about = None)] struct Cli { /// Optional name to operate on - #[clap(value_parser)] name: Option, /// Sets a custom config file - #[clap(short, long, value_parser, value_name = "FILE")] + #[clap(short, long, value_name = "FILE")] config: Option, /// Turn debugging information on @@ -26,7 +25,7 @@ enum Commands { /// does testing things Test { /// lists test values - #[clap(short, long, action)] + #[clap(short, long)] list: bool, }, } diff --git a/examples/tutorial_derive/02_app_settings.rs b/examples/tutorial_derive/02_app_settings.rs index f33452f421a..1e7f1a2ca2f 100644 --- a/examples/tutorial_derive/02_app_settings.rs +++ b/examples/tutorial_derive/02_app_settings.rs @@ -4,9 +4,9 @@ use clap::Parser; #[clap(author, version, about, long_about = None)] #[clap(allow_negative_numbers = true)] struct Cli { - #[clap(long, value_parser)] + #[clap(long)] two: String, - #[clap(long, value_parser)] + #[clap(long)] one: String, } diff --git a/examples/tutorial_derive/02_apps.rs b/examples/tutorial_derive/02_apps.rs index b97ce1eed6a..442e928a9f6 100644 --- a/examples/tutorial_derive/02_apps.rs +++ b/examples/tutorial_derive/02_apps.rs @@ -6,9 +6,9 @@ use clap::Parser; #[clap(version = "1.0")] #[clap(about = "Does awesome things", long_about = None)] struct Cli { - #[clap(long, value_parser)] + #[clap(long)] two: String, - #[clap(long, value_parser)] + #[clap(long)] one: String, } diff --git a/examples/tutorial_derive/02_crate.rs b/examples/tutorial_derive/02_crate.rs index 5576f998c15..06e16b0d178 100644 --- a/examples/tutorial_derive/02_crate.rs +++ b/examples/tutorial_derive/02_crate.rs @@ -3,9 +3,9 @@ use clap::Parser; #[derive(Parser)] #[clap(author, version, about, long_about = None)] // Read from `Cargo.toml` struct Cli { - #[clap(long, value_parser)] + #[clap(long)] two: String, - #[clap(long, value_parser)] + #[clap(long)] one: String, } diff --git a/examples/tutorial_derive/03_01_flag_bool.rs b/examples/tutorial_derive/03_01_flag_bool.rs index de677d8c675..8b574b7481e 100644 --- a/examples/tutorial_derive/03_01_flag_bool.rs +++ b/examples/tutorial_derive/03_01_flag_bool.rs @@ -3,7 +3,7 @@ use clap::Parser; #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Cli { - #[clap(short, long, action)] + #[clap(short, long)] verbose: bool, } diff --git a/examples/tutorial_derive/03_02_option.rs b/examples/tutorial_derive/03_02_option.rs index 75b67afe753..b09aadf20de 100644 --- a/examples/tutorial_derive/03_02_option.rs +++ b/examples/tutorial_derive/03_02_option.rs @@ -3,7 +3,7 @@ use clap::Parser; #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Cli { - #[clap(short, long, value_parser)] + #[clap(short, long)] name: Option, } diff --git a/examples/tutorial_derive/03_03_positional.rs b/examples/tutorial_derive/03_03_positional.rs index 7478951f1a8..f7850ddccfe 100644 --- a/examples/tutorial_derive/03_03_positional.rs +++ b/examples/tutorial_derive/03_03_positional.rs @@ -3,7 +3,6 @@ use clap::Parser; #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Cli { - #[clap(value_parser)] name: Option, } diff --git a/examples/tutorial_derive/03_04_subcommands.rs b/examples/tutorial_derive/03_04_subcommands.rs index 62a45a97eaf..86cf444c21b 100644 --- a/examples/tutorial_derive/03_04_subcommands.rs +++ b/examples/tutorial_derive/03_04_subcommands.rs @@ -11,10 +11,7 @@ struct Cli { #[derive(Subcommand)] enum Commands { /// Adds files to myapp - Add { - #[clap(value_parser)] - name: Option, - }, + Add { name: Option }, } fn main() { diff --git a/examples/tutorial_derive/03_04_subcommands_alt.rs b/examples/tutorial_derive/03_04_subcommands_alt.rs index b6124936c93..0a5b60682d4 100644 --- a/examples/tutorial_derive/03_04_subcommands_alt.rs +++ b/examples/tutorial_derive/03_04_subcommands_alt.rs @@ -16,7 +16,6 @@ enum Commands { #[derive(Args)] struct Add { - #[clap(value_parser)] name: Option, } diff --git a/examples/tutorial_derive/03_05_default_values.rs b/examples/tutorial_derive/03_05_default_values.rs index 10a1ec80880..af4532bbc7d 100644 --- a/examples/tutorial_derive/03_05_default_values.rs +++ b/examples/tutorial_derive/03_05_default_values.rs @@ -3,7 +3,7 @@ use clap::Parser; #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Cli { - #[clap(default_value_t = String::from("alice"), value_parser)] + #[clap(default_value_t = String::from("alice"))] name: String, } diff --git a/examples/tutorial_derive/04_01_enum.rs b/examples/tutorial_derive/04_01_enum.rs index 84b4cace495..3a2df391ffb 100644 --- a/examples/tutorial_derive/04_01_enum.rs +++ b/examples/tutorial_derive/04_01_enum.rs @@ -4,7 +4,7 @@ use clap::{ArgEnum, Parser}; #[clap(author, version, about, long_about = None)] struct Cli { /// What mode to run the program in - #[clap(arg_enum, value_parser)] + #[clap(arg_enum)] mode: Mode, } diff --git a/examples/tutorial_derive/04_03_relations.rs b/examples/tutorial_derive/04_03_relations.rs index f8523902d6b..f0e1e5913ba 100644 --- a/examples/tutorial_derive/04_03_relations.rs +++ b/examples/tutorial_derive/04_03_relations.rs @@ -9,30 +9,30 @@ use clap::{ArgGroup, Parser}; ))] struct Cli { /// set version manually - #[clap(long, value_name = "VER", value_parser)] + #[clap(long, value_name = "VER")] set_ver: Option, /// auto inc major - #[clap(long, action)] + #[clap(long)] major: bool, /// auto inc minor - #[clap(long, action)] + #[clap(long)] minor: bool, /// auto inc patch - #[clap(long, action)] + #[clap(long)] patch: bool, /// some regular input - #[clap(group = "input", value_parser)] + #[clap(group = "input")] input_file: Option, /// some special input argument - #[clap(long, group = "input", value_parser)] + #[clap(long, group = "input")] spec_in: Option, - #[clap(short, requires = "input", value_parser)] + #[clap(short, requires = "input")] config: Option, } diff --git a/examples/tutorial_derive/04_04_custom.rs b/examples/tutorial_derive/04_04_custom.rs index 454d489c1f7..a03345b8297 100644 --- a/examples/tutorial_derive/04_04_custom.rs +++ b/examples/tutorial_derive/04_04_custom.rs @@ -4,30 +4,29 @@ use clap::{CommandFactory, ErrorKind, Parser}; #[clap(author, version, about, long_about = None)] struct Cli { /// set version manually - #[clap(long, value_name = "VER", value_parser)] + #[clap(long, value_name = "VER")] set_ver: Option, /// auto inc major - #[clap(long, action)] + #[clap(long)] major: bool, /// auto inc minor - #[clap(long, action)] + #[clap(long)] minor: bool, /// auto inc patch - #[clap(long, action)] + #[clap(long)] patch: bool, /// some regular input - #[clap(value_parser)] input_file: Option, /// some special input argument - #[clap(long, value_parser)] + #[clap(long)] spec_in: Option, - #[clap(short, value_parser)] + #[clap(short)] config: Option, } diff --git a/examples/tutorial_derive/05_01_assert.rs b/examples/tutorial_derive/05_01_assert.rs index 66dca727f3d..e9948585236 100644 --- a/examples/tutorial_derive/05_01_assert.rs +++ b/examples/tutorial_derive/05_01_assert.rs @@ -4,7 +4,6 @@ use clap::Parser; #[clap(author, version, about, long_about = None)] struct Cli { /// Network port to use - #[clap(value_parser)] port: u16, } diff --git a/examples/typed-derive.rs b/examples/typed-derive.rs index 31084029d36..2f82b626048 100644 --- a/examples/typed-derive.rs +++ b/examples/typed-derive.rs @@ -4,19 +4,19 @@ use std::error::Error; #[derive(Parser, Debug)] // requires `derive` feature struct Args { /// Implicitly using `std::str::FromStr` - #[clap(short = 'O', value_parser)] + #[clap(short = 'O')] optimization: Option, /// Allow invalid UTF-8 paths - #[clap(short = 'I', value_parser, value_name = "DIR", value_hint = clap::ValueHint::DirPath)] + #[clap(short = 'I', value_name = "DIR", value_hint = clap::ValueHint::DirPath)] include: Option, /// Handle IP addresses - #[clap(long, value_parser)] + #[clap(long)] bind: Option, /// Allow human-readable durations - #[clap(long, value_parser)] + #[clap(long)] sleep: Option, /// Hand-written parser for tuples diff --git a/src/derive.rs b/src/derive.rs index c41033e5b20..dae568faeec 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -36,10 +36,10 @@ use std::ffi::OsString; /// #[clap(name = "demo")] /// struct Context { /// /// More verbose output -/// #[clap(long, value_parser)] +/// #[clap(long)] /// verbose: bool, /// /// An optional name -/// #[clap(short, long, value_parser)] +/// #[clap(short, long)] /// name: Option, /// } /// ``` @@ -354,7 +354,7 @@ pub trait Subcommand: FromArgMatches + Sized { #[cfg_attr(feature = "derive", doc = " ```")] /// #[derive(clap::Parser)] /// struct Args { -/// #[clap(value_enum, value_parser)] +/// #[clap(value_enum)] /// level: Level, /// } /// diff --git a/tests/derive_ui/default_value_t_invalid.rs b/tests/derive_ui/default_value_t_invalid.rs index 25ef73ebde7..47fdc9f9a78 100644 --- a/tests/derive_ui/default_value_t_invalid.rs +++ b/tests/derive_ui/default_value_t_invalid.rs @@ -11,7 +11,7 @@ use clap::Parser; #[derive(Parser, Debug)] #[clap(name = "basic")] struct Opt { - #[clap(value_parser, default_value_t = -10)] + #[clap(default_value_t = -10)] value: u32, } diff --git a/tests/derive_ui/default_value_t_invalid.stderr b/tests/derive_ui/default_value_t_invalid.stderr index 8ce536a9a48..22cbe359a53 100644 --- a/tests/derive_ui/default_value_t_invalid.stderr +++ b/tests/derive_ui/default_value_t_invalid.stderr @@ -1,7 +1,7 @@ error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/default_value_t_invalid.rs:14:44 + --> tests/derive_ui/default_value_t_invalid.rs:14:30 | -14 | #[clap(value_parser, default_value_t = -10)] - | ^^^ cannot apply unary operator `-` +14 | #[clap(default_value_t = -10)] + | ^^^ cannot apply unary operator `-` | = note: unsigned values cannot be negated diff --git a/tests/derive_ui/flatten_and_methods.rs b/tests/derive_ui/flatten_and_methods.rs index 45dbc4fdcc2..b1020a8e988 100644 --- a/tests/derive_ui/flatten_and_methods.rs +++ b/tests/derive_ui/flatten_and_methods.rs @@ -10,9 +10,9 @@ use clap::Parser; #[derive(Parser, Debug)] struct DaemonOpts { - #[clap(short, value_parser)] + #[clap(short)] user: String, - #[clap(short, value_parser)] + #[clap(short)] group: String, } diff --git a/tests/derive_ui/skip_flatten.rs b/tests/derive_ui/skip_flatten.rs index 11941f971cc..95e9ba4d614 100644 --- a/tests/derive_ui/skip_flatten.rs +++ b/tests/derive_ui/skip_flatten.rs @@ -11,7 +11,7 @@ use clap::Parser; #[derive(Parser, Debug)] #[clap(name = "make-cookie")] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(skip, flatten)] @@ -22,13 +22,10 @@ struct MakeCookie { enum Command { #[clap(name = "pound")] /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, } diff --git a/tests/derive_ui/skip_subcommand.rs b/tests/derive_ui/skip_subcommand.rs index 479c8fddbf4..9f38d1eb95f 100644 --- a/tests/derive_ui/skip_subcommand.rs +++ b/tests/derive_ui/skip_subcommand.rs @@ -11,7 +11,7 @@ use clap::Parser; #[derive(Parser, Debug)] #[clap(name = "make-cookie")] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(subcommand, skip)] @@ -22,13 +22,10 @@ struct MakeCookie { enum Command { #[clap(name = "pound")] /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, } diff --git a/tests/derive_ui/skip_without_default.rs b/tests/derive_ui/skip_without_default.rs index e7a845eeb42..682b13b766c 100644 --- a/tests/derive_ui/skip_without_default.rs +++ b/tests/derive_ui/skip_without_default.rs @@ -17,7 +17,7 @@ enum Kind { #[derive(Parser, Debug)] #[clap(name = "test")] pub struct Opt { - #[clap(short, value_parser)] + #[clap(short)] number: u32, #[clap(skip)] k: Kind, diff --git a/tests/derive_ui/struct_subcommand.rs b/tests/derive_ui/struct_subcommand.rs index 5ac9c21b38d..865ad97f0fb 100644 --- a/tests/derive_ui/struct_subcommand.rs +++ b/tests/derive_ui/struct_subcommand.rs @@ -11,7 +11,7 @@ use clap::Parser; #[derive(Parser, Debug)] #[clap(name = "basic", subcommand)] struct Opt { - #[clap(short, value_parser)] + #[clap(short)] s: String, } diff --git a/tests/derive_ui/subcommand_and_flatten.rs b/tests/derive_ui/subcommand_and_flatten.rs index bba348437d4..f2b4caff3f6 100644 --- a/tests/derive_ui/subcommand_and_flatten.rs +++ b/tests/derive_ui/subcommand_and_flatten.rs @@ -10,7 +10,7 @@ use clap::Parser; #[derive(Parser, Debug)] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(subcommand, flatten)] @@ -20,13 +20,10 @@ struct MakeCookie { #[derive(Parser, Debug)] enum Command { /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, } diff --git a/tests/derive_ui/subcommand_and_methods.rs b/tests/derive_ui/subcommand_and_methods.rs index bb7215dd821..e0b3cf5ce10 100644 --- a/tests/derive_ui/subcommand_and_methods.rs +++ b/tests/derive_ui/subcommand_and_methods.rs @@ -10,7 +10,7 @@ use clap::Parser; #[derive(Parser, Debug)] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(subcommand, long)] @@ -20,13 +20,10 @@ struct MakeCookie { #[derive(Parser, Debug)] enum Command { /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, } diff --git a/tests/derive_ui/subcommand_opt_opt.rs b/tests/derive_ui/subcommand_opt_opt.rs index 701399c4d30..ca8cba6d457 100644 --- a/tests/derive_ui/subcommand_opt_opt.rs +++ b/tests/derive_ui/subcommand_opt_opt.rs @@ -10,7 +10,7 @@ use clap::Parser; #[derive(Parser, Debug)] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(subcommand)] @@ -20,13 +20,10 @@ struct MakeCookie { #[derive(Parser, Debug)] enum Command { /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, } diff --git a/tests/derive_ui/subcommand_opt_vec.rs b/tests/derive_ui/subcommand_opt_vec.rs index 7ce7909b536..210af22a04c 100644 --- a/tests/derive_ui/subcommand_opt_vec.rs +++ b/tests/derive_ui/subcommand_opt_vec.rs @@ -10,7 +10,7 @@ use clap::Parser; #[derive(Parser, Debug)] struct MakeCookie { - #[clap(short, value_parser)] + #[clap(short)] s: String, #[clap(subcommand)] @@ -20,13 +20,10 @@ struct MakeCookie { #[derive(Parser, Debug)] enum Command { /// Pound acorns into flour for cookie dough. - Pound { - #[clap(value_parser)] - acorns: u32, - }, + Pound { acorns: u32 }, Sparkle { - #[clap(short, value_parser)] + #[clap(short)] color: String, }, }