Skip to content

Commit 393215e

Browse files
committed
refactor(cli): Align with clap 3.1 on terminology
clap 3.1 renamed `App` to `Command`. When we upgrade to clap v4, the lifetime will be removed and we can just use `clap::Command` instead of a type alias. This is prep for that.
1 parent 8dea819 commit 393215e

40 files changed

+45
-45
lines changed

src/bin/cargo/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,14 @@ impl GlobalArgs {
387387
}
388388
}
389389

390-
pub fn cli() -> App {
390+
pub fn cli() -> Command {
391391
let is_rustup = std::env::var_os("RUSTUP_HOME").is_some();
392392
let usage = if is_rustup {
393393
"cargo [+toolchain] [OPTIONS] [SUBCOMMAND]"
394394
} else {
395395
"cargo [OPTIONS] [SUBCOMMAND]"
396396
};
397-
App::new("cargo")
397+
Command::new("cargo")
398398
.allow_external_subcommands(true)
399399
.setting(AppSettings::DeriveDisplayOrder)
400400
// Doesn't mix well with our list of common cargo commands. See clap-rs/clap#3108 for

src/bin/cargo/commands/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use cargo::util::interning::InternedString;
1212
use cargo::util::toml_mut::manifest::DepTable;
1313
use cargo::CargoResult;
1414

15-
pub fn cli() -> clap::Command<'static> {
15+
pub fn cli() -> Command {
1616
clap::Command::new("add")
1717
.setting(clap::AppSettings::DeriveDisplayOrder)
1818
.about("Add dependencies to a Cargo.toml manifest file")

src/bin/cargo/commands/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::command_prelude::*;
22
use cargo::ops::{self, TestOptions};
33

4-
pub fn cli() -> App {
4+
pub fn cli() -> Command {
55
subcommand("bench")
66
.trailing_var_arg(true)
77
.about("Execute all benchmarks of a local package")

src/bin/cargo/commands/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;
22

33
use cargo::ops;
44

5-
pub fn cli() -> App {
5+
pub fn cli() -> Command {
66
subcommand("build")
77
// subcommand aliases are handled in aliased_command()
88
// .alias("b")

src/bin/cargo/commands/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;
22

33
use cargo::ops;
44

5-
pub fn cli() -> App {
5+
pub fn cli() -> Command {
66
subcommand("check")
77
// subcommand aliases are handled in aliased_command()
88
// .alias("c")

src/bin/cargo/commands/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::command_prelude::*;
33
use cargo::ops::{self, CleanOptions};
44
use cargo::util::print_available_packages;
55

6-
pub fn cli() -> App {
6+
pub fn cli() -> Command {
77
subcommand("clean")
88
.about("Remove artifacts that cargo has generated in the past")
99
.arg_quiet()

src/bin/cargo/commands/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::command_prelude::*;
22
use cargo::ops::cargo_config;
33

4-
pub fn cli() -> App {
4+
pub fn cli() -> Command {
55
subcommand("config")
66
.about("Inspect configuration values")
77
.after_help("Run `cargo help config` for more detailed information.\n")

src/bin/cargo/commands/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;
22

33
use cargo::ops::{self, DocOptions};
44

5-
pub fn cli() -> App {
5+
pub fn cli() -> Command {
66
subcommand("doc")
77
// subcommand aliases are handled in aliased_command()
88
// .alias("d")

src/bin/cargo/commands/fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::command_prelude::*;
33
use cargo::ops;
44
use cargo::ops::FetchOptions;
55

6-
pub fn cli() -> App {
6+
pub fn cli() -> Command {
77
subcommand("fetch")
88
.about("Fetch dependencies of a package from the network")
99
.arg_quiet()

src/bin/cargo/commands/fix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;
22

33
use cargo::ops;
44

5-
pub fn cli() -> App {
5+
pub fn cli() -> Command {
66
subcommand("fix")
77
.about("Automatically fix lint warnings reported by rustc")
88
.arg_quiet()

0 commit comments

Comments
 (0)