diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 4034b9b1aa6..58dcd183ca9 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -479,8 +479,7 @@ See 'cargo help ' for more information on a specific command.\n", .help("Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details") .short('Z') .value_name("FLAG") - .multiple(true) - .number_of_values(1) + .multiple_occurrences(true) .global(true), ) .subcommands(commands::builtin()) diff --git a/src/bin/cargo/commands/bench.rs b/src/bin/cargo/commands/bench.rs index d76a7f9dc3d..64a89bdb93a 100644 --- a/src/bin/cargo/commands/bench.rs +++ b/src/bin/cargo/commands/bench.rs @@ -13,7 +13,7 @@ pub fn cli() -> App { .arg( Arg::new("args") .help("Arguments for the bench binary") - .multiple(true) + .multiple_values(true) .last(true), ) .arg_targets_all( diff --git a/src/bin/cargo/commands/install.rs b/src/bin/cargo/commands/install.rs index 5cfa5e32005..621558d97c4 100644 --- a/src/bin/cargo/commands/install.rs +++ b/src/bin/cargo/commands/install.rs @@ -8,7 +8,11 @@ pub fn cli() -> App { subcommand("install") .about("Install a Rust binary. Default location is $HOME/.cargo/bin") .arg_quiet() - .arg(Arg::new("crate").forbid_empty_values(true).multiple(true)) + .arg( + Arg::new("crate") + .forbid_empty_values(true) + .multiple_values(true), + ) .arg( opt("version", "Specify a version to install") .alias("vers") diff --git a/src/bin/cargo/commands/run.rs b/src/bin/cargo/commands/run.rs index 797837f24fd..d90399dd8a8 100644 --- a/src/bin/cargo/commands/run.rs +++ b/src/bin/cargo/commands/run.rs @@ -11,7 +11,11 @@ pub fn cli() -> App { .setting(AppSettings::TrailingVarArg) .about("Run a binary or example of the local package") .arg_quiet() - .arg(Arg::new("args").allow_invalid_utf8(true).multiple(true)) + .arg( + Arg::new("args") + .allow_invalid_utf8(true) + .multiple_values(true), + ) .arg_targets_bin_example( "Name of the bin target to run", "Name of the example target to run", diff --git a/src/bin/cargo/commands/rustc.rs b/src/bin/cargo/commands/rustc.rs index d7015358788..c9291d4f02e 100644 --- a/src/bin/cargo/commands/rustc.rs +++ b/src/bin/cargo/commands/rustc.rs @@ -10,7 +10,7 @@ pub fn cli() -> App { .setting(AppSettings::TrailingVarArg) .about("Compile a package, and pass extra options to the compiler") .arg_quiet() - .arg(Arg::new("args").multiple(true).help("Rustc flags")) + .arg(Arg::new("args").multiple_values(true).help("Rustc flags")) .arg_package("Package to build") .arg_jobs() .arg_targets_all( diff --git a/src/bin/cargo/commands/rustdoc.rs b/src/bin/cargo/commands/rustdoc.rs index 8fc5078486a..3f5d07d9d2b 100644 --- a/src/bin/cargo/commands/rustdoc.rs +++ b/src/bin/cargo/commands/rustdoc.rs @@ -7,7 +7,7 @@ pub fn cli() -> App { .setting(AppSettings::TrailingVarArg) .about("Build a package's documentation, using specified custom flags.") .arg_quiet() - .arg(Arg::new("args").multiple(true)) + .arg(Arg::new("args").multiple_values(true)) .arg(opt( "open", "Opens the docs in a browser after the operation", diff --git a/src/bin/cargo/commands/search.rs b/src/bin/cargo/commands/search.rs index 003e1d848ae..14d6fba3b54 100644 --- a/src/bin/cargo/commands/search.rs +++ b/src/bin/cargo/commands/search.rs @@ -8,7 +8,7 @@ pub fn cli() -> App { subcommand("search") .about("Search packages in crates.io") .arg_quiet() - .arg(Arg::new("query").multiple(true)) + .arg(Arg::new("query").multiple_values(true)) .arg_index() .arg( opt( diff --git a/src/bin/cargo/commands/test.rs b/src/bin/cargo/commands/test.rs index caedb47aa2e..25b949dcfb9 100644 --- a/src/bin/cargo/commands/test.rs +++ b/src/bin/cargo/commands/test.rs @@ -15,7 +15,7 @@ pub fn cli() -> App { .arg( Arg::new("args") .help("Arguments for the test binary") - .multiple(true) + .multiple_values(true) .last(true), ) .arg( diff --git a/src/bin/cargo/commands/uninstall.rs b/src/bin/cargo/commands/uninstall.rs index 7f6e3829bb3..eaec9ecc3f6 100644 --- a/src/bin/cargo/commands/uninstall.rs +++ b/src/bin/cargo/commands/uninstall.rs @@ -6,7 +6,7 @@ pub fn cli() -> App { subcommand("uninstall") .about("Remove a Rust binary") .arg_quiet() - .arg(Arg::new("spec").multiple(true)) + .arg(Arg::new("spec").multiple_values(true)) .arg_package_spec_simple("Package to uninstall") .arg(multi_opt("bin", "NAME", "Only uninstall the binary NAME")) .arg(opt("root", "Directory to uninstall packages from").value_name("DIR")) diff --git a/src/bin/cargo/commands/vendor.rs b/src/bin/cargo/commands/vendor.rs index 5bcec7aad94..697c235412c 100644 --- a/src/bin/cargo/commands/vendor.rs +++ b/src/bin/cargo/commands/vendor.rs @@ -24,7 +24,8 @@ pub fn cli() -> App { .help("Additional `Cargo.toml` to sync and vendor") .value_name("TOML") .allow_invalid_utf8(true) - .multiple(true), + .multiple_occurrences(true) + .multiple_values(true), ) .arg( Arg::new("respect-source-config") diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index b5c10c18937..c1ed561de00 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -1,5 +1,3 @@ -#![allow(deprecated)] - use crate::core::compiler::{BuildConfig, MessageFormat}; use crate::core::resolver::CliFeatures; use crate::core::{Edition, Workspace}; @@ -264,20 +262,16 @@ pub fn optional_multi_opt( ) -> Arg<'static> { opt(name, help) .value_name(value_name) - .multiple(true) + .multiple_occurrences(true) + .multiple_values(true) .min_values(0) .number_of_values(1) } pub fn multi_opt(name: &'static str, value_name: &'static str, help: &'static str) -> Arg<'static> { - // Note that all `.multiple(true)` arguments in Cargo should specify - // `.number_of_values(1)` as well, so that `--foo val1 val2` is - // *not* parsed as `foo` with values ["val1", "val2"]. - // `number_of_values` should become the default in clap 3. opt(name, help) .value_name(value_name) - .multiple(true) - .number_of_values(1) + .multiple_occurrences(true) } pub fn subcommand(name: &'static str) -> App {