Skip to content

Commit 2084f5c

Browse files
committed
refactor: Resolve clap deprecations
1 parent 4b10c40 commit 2084f5c

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

src/bin/cargo/commands/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use cargo::ops::{self, TestOptions};
33

44
pub fn cli() -> Command {
55
subcommand("bench")
6-
.trailing_var_arg(true)
76
.about("Execute all benchmarks of a local package")
87
.arg_quiet()
98
.arg(
@@ -14,7 +13,8 @@ pub fn cli() -> Command {
1413
.arg(
1514
Arg::new("args")
1615
.help("Arguments for the bench binary")
17-
.num_args(0..),
16+
.num_args(0..)
17+
.trailing_var_arg(true),
1818
)
1919
.arg_targets_all(
2020
"Benchmark only this package's library",

src/bin/cargo/commands/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ pub fn cli() -> Command {
88
subcommand("run")
99
// subcommand aliases are handled in aliased_command()
1010
// .alias("r")
11-
.trailing_var_arg(true)
1211
.about("Run a binary or example of the local package")
1312
.arg_quiet()
1413
.arg(
1514
Arg::new("args")
1615
.value_parser(value_parser!(std::ffi::OsString))
17-
.num_args(0..),
16+
.num_args(0..)
17+
.trailing_var_arg(true),
1818
)
1919
.arg_targets_bin_example(
2020
"Name of the bin target to run",

src/bin/cargo/commands/rustc.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ const CRATE_TYPE_ARG_NAME: &str = "crate-type";
77

88
pub fn cli() -> Command {
99
subcommand("rustc")
10-
.trailing_var_arg(true)
1110
.about("Compile a package, and pass extra options to the compiler")
1211
.arg_quiet()
13-
.arg(Arg::new("args").num_args(0..).help("Rustc flags"))
12+
.arg(
13+
Arg::new("args")
14+
.num_args(0..)
15+
.help("Rustc flags")
16+
.trailing_var_arg(true),
17+
)
1418
.arg_package("Package to build")
1519
.arg_jobs()
1620
.arg_targets_all(

src/bin/cargo/commands/rustdoc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ use crate::command_prelude::*;
44

55
pub fn cli() -> Command {
66
subcommand("rustdoc")
7-
.trailing_var_arg(true)
87
.about("Build a package's documentation, using specified custom flags.")
98
.arg_quiet()
10-
.arg(Arg::new("args").num_args(0..))
9+
.arg(Arg::new("args").num_args(0..).trailing_var_arg(true))
1110
.arg(flag(
1211
"open",
1312
"Opens the docs in a browser after the operation",

src/bin/cargo/commands/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn cli() -> Command {
55
subcommand("test")
66
// Subcommand aliases are handled in `aliased_command()`.
77
// .alias("t")
8-
.trailing_var_arg(true)
98
.about("Execute all unit and integration tests and build examples of a local package")
109
.arg(
1110
Arg::new("TESTNAME")
@@ -15,7 +14,8 @@ pub fn cli() -> Command {
1514
.arg(
1615
Arg::new("args")
1716
.help("Arguments for the test binary")
18-
.num_args(0..),
17+
.num_args(0..)
18+
.trailing_var_arg(true),
1919
)
2020
.arg(
2121
flag(

0 commit comments

Comments
 (0)