Rollup merge of #121788 - klensy:clap-deprecated-fix, r=clubby789

bootstrap: fix clap deprecated warnings

Run 'cargo check --features clap/deprecated' and fix warnings
This commit is contained in:
Guillaume Gomez 2024-02-29 14:33:52 +01:00 committed by GitHub
commit 7147112c8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View File

@ -642,22 +642,22 @@ impl<'a> ShouldRun<'a> {
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum Kind { pub enum Kind {
#[clap(alias = "b")] #[value(alias = "b")]
Build, Build,
#[clap(alias = "c")] #[value(alias = "c")]
Check, Check,
Clippy, Clippy,
Fix, Fix,
Format, Format,
#[clap(alias = "t")] #[value(alias = "t")]
Test, Test,
Bench, Bench,
#[clap(alias = "d")] #[value(alias = "d")]
Doc, Doc,
Clean, Clean,
Dist, Dist,
Install, Install,
#[clap(alias = "r")] #[value(alias = "r")]
Run, Run,
Setup, Setup,
Suggest, Suggest,

View File

@ -31,7 +31,7 @@ pub enum Warnings {
/// Deserialized version of all flags for this compile. /// Deserialized version of all flags for this compile.
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap( #[command(
override_usage = "x.py <subcommand> [options] [<paths>...]", override_usage = "x.py <subcommand> [options] [<paths>...]",
disable_help_subcommand(true), disable_help_subcommand(true),
about = "", about = "",
@ -118,7 +118,7 @@ pub struct Flags {
// This overrides the deny-warnings configuration option, // This overrides the deny-warnings configuration option,
// which passes -Dwarnings to the compiler invocations. // which passes -Dwarnings to the compiler invocations.
#[arg(global(true), long)] #[arg(global(true), long)]
#[clap(value_enum, default_value_t=Warnings::Default, value_name = "deny|warn")] #[arg(value_enum, default_value_t=Warnings::Default, value_name = "deny|warn")]
/// if value is deny, will deny warnings /// if value is deny, will deny warnings
/// if value is warn, will emit warnings /// if value is warn, will emit warnings
/// otherwise, use the default configured behaviour /// otherwise, use the default configured behaviour
@ -132,7 +132,7 @@ pub struct Flags {
pub json_output: bool, pub json_output: bool,
#[arg(global(true), long, value_name = "STYLE")] #[arg(global(true), long, value_name = "STYLE")]
#[clap(value_enum, default_value_t = Color::Auto)] #[arg(value_enum, default_value_t = Color::Auto)]
/// whether to use color in cargo and rustc output /// whether to use color in cargo and rustc output
pub color: Color, pub color: Color,
@ -188,7 +188,7 @@ impl Flags {
let it = std::iter::once(&first).chain(args.iter()); let it = std::iter::once(&first).chain(args.iter());
// We need to check for `<cmd> -h -v`, in which case we list the paths // We need to check for `<cmd> -h -v`, in which case we list the paths
#[derive(Parser)] #[derive(Parser)]
#[clap(disable_help_flag(true))] #[command(disable_help_flag(true))]
struct HelpVerboseOnly { struct HelpVerboseOnly {
#[arg(short, long)] #[arg(short, long)]
help: bool, help: bool,
@ -218,7 +218,7 @@ impl Flags {
#[derive(Debug, Clone, Default, clap::Subcommand)] #[derive(Debug, Clone, Default, clap::Subcommand)]
pub enum Subcommand { pub enum Subcommand {
#[clap(aliases = ["b"], long_about = "\n #[command(aliases = ["b"], long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to directories to the crates This subcommand accepts a number of paths to directories to the crates
and/or artifacts to compile. For example, for a quick build of a usable and/or artifacts to compile. For example, for a quick build of a usable
@ -233,7 +233,7 @@ pub enum Subcommand {
/// Compile either the compiler or libraries /// Compile either the compiler or libraries
#[default] #[default]
Build, Build,
#[clap(aliases = ["c"], long_about = "\n #[command(aliases = ["c"], long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to directories to the crates This subcommand accepts a number of paths to directories to the crates
and/or artifacts to compile. For example: and/or artifacts to compile. For example:
@ -246,7 +246,7 @@ pub enum Subcommand {
all_targets: bool, all_targets: bool,
}, },
/// Run Clippy (uses rustup/cargo-installed clippy binary) /// Run Clippy (uses rustup/cargo-installed clippy binary)
#[clap(long_about = "\n #[command(long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to directories to the crates This subcommand accepts a number of paths to directories to the crates
and/or artifacts to run clippy against. For example: and/or artifacts to run clippy against. For example:
@ -273,14 +273,14 @@ pub enum Subcommand {
forbid: Vec<String>, forbid: Vec<String>,
}, },
/// Run cargo fix /// Run cargo fix
#[clap(long_about = "\n #[command(long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to directories to the crates This subcommand accepts a number of paths to directories to the crates
and/or artifacts to run `cargo fix` against. For example: and/or artifacts to run `cargo fix` against. For example:
./x.py fix library/core ./x.py fix library/core
./x.py fix library/core library/proc_macro")] ./x.py fix library/core library/proc_macro")]
Fix, Fix,
#[clap( #[command(
name = "fmt", name = "fmt",
long_about = "\n long_about = "\n
Arguments: Arguments:
@ -295,7 +295,7 @@ pub enum Subcommand {
#[arg(long)] #[arg(long)]
check: bool, check: bool,
}, },
#[clap(aliases = ["d"], long_about = "\n #[command(aliases = ["d"], long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to directories of documentation This subcommand accepts a number of paths to directories of documentation
to build. For example: to build. For example:
@ -316,7 +316,7 @@ pub enum Subcommand {
/// render the documentation in JSON format in addition to the usual HTML format /// render the documentation in JSON format in addition to the usual HTML format
json: bool, json: bool,
}, },
#[clap(aliases = ["t"], long_about = "\n #[command(aliases = ["t"], long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to test directories that This subcommand accepts a number of paths to test directories that
should be compiled and run. For example: should be compiled and run. For example:
@ -400,7 +400,7 @@ pub enum Subcommand {
Dist, Dist,
/// Install distribution artifacts /// Install distribution artifacts
Install, Install,
#[clap(aliases = ["r"], long_about = "\n #[command(aliases = ["r"], long_about = "\n
Arguments: Arguments:
This subcommand accepts a number of paths to tools to build and run. For This subcommand accepts a number of paths to tools to build and run. For
example: example:
@ -413,7 +413,7 @@ pub enum Subcommand {
args: Vec<String>, args: Vec<String>,
}, },
/// Set up the environment for development /// Set up the environment for development
#[clap(long_about = format!( #[command(long_about = format!(
"\n "\n
x.py setup creates a `config.toml` which changes the defaults for x.py itself, x.py setup creates a `config.toml` which changes the defaults for x.py itself,
as well as setting up a git pre-push hook, VS Code config and toolchain link. as well as setting up a git pre-push hook, VS Code config and toolchain link.
@ -434,7 +434,7 @@ Arguments:
profile: Option<PathBuf>, profile: Option<PathBuf>,
}, },
/// Suggest a subset of tests to run, based on modified files /// Suggest a subset of tests to run, based on modified files
#[clap(long_about = "\n")] #[command(long_about = "\n")]
Suggest { Suggest {
/// run suggested tests /// run suggested tests
#[arg(long)] #[arg(long)]