Merge pull request #4128 from epage/default

fix(derive): Remove error case for default_value
This commit is contained in:
Ed Page 2022-08-26 14:16:10 -05:00 committed by GitHub
commit 2f4e42f227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 35 deletions

View file

@ -161,12 +161,6 @@ impl Parse for ClapAttr {
"external_subcommand" => Ok(ExternalSubcommand(name)),
"verbatim_doc_comment" => Ok(VerbatimDocComment(name)),
"default_value" => {
abort!(name,
"`#[clap(default_value)` attribute (without a value) has been replaced by `#[clap(default_value_t)]`.";
help = "Change the attribute to `#[clap(default_value_t)]`";
)
}
"default_value_t" => Ok(DefaultValueT(name, None)),
"default_value_os_t" => Ok(DefaultValueOsT(name, None)),
"about" => (Ok(About(name))),

View file

@ -1,21 +0,0 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use clap::Parser;
#[derive(Parser, Debug)]
#[clap(name = "basic")]
struct Opt {
#[clap(default_value)]
value: i32,
}
fn main() {
let opt = Opt::parse();
println!("{:?}", opt);
}

View file

@ -1,8 +0,0 @@
error: `#[clap(default_value)` attribute (without a value) has been replaced by `#[clap(default_value_t)]`.
= help: Change the attribute to `#[clap(default_value_t)]`
--> tests/derive_ui/default_value_wo_value_removed.rs:14:12
|
14 | #[clap(default_value)]
| ^^^^^^^^^^^^^