Skip to content

Commit 7e4656a

Browse files
committed
Update rustup mode tests
1 parent 55c6fdb commit 7e4656a

File tree

44 files changed

+259
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+259
-254
lines changed

src/cli/rustup_mode.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ pub fn main() -> Result<utils::ExitCode> {
7171
let matches = match cli().try_get_matches_from(process().args_os()) {
7272
Ok(matches) => Ok(matches),
7373
Err(err) if err.kind() == DisplayHelp => {
74-
writeln!(process().stdout().lock(), "{}", err)?;
74+
writeln!(process().stdout().lock(), "{err}")?;
7575
return Ok(utils::ExitCode(0));
7676
}
7777
Err(err) if err.kind() == DisplayVersion => {
78-
writeln!(process().stdout().lock(), "{}", err)?;
78+
writeln!(process().stdout().lock(), "{err}")?;
7979
info!("This is the version for the rustup toolchain manager, not the rustc compiler.");
8080

8181
fn rustc_version() -> std::result::Result<String, Box<dyn std::error::Error>> {
@@ -107,7 +107,7 @@ pub fn main() -> Result<utils::ExitCode> {
107107
]
108108
.contains(&err.kind())
109109
{
110-
writeln!(process().stdout().lock(), "{}", err)?;
110+
writeln!(process().stdout().lock(), "{err}")?;
111111
return Ok(utils::ExitCode(1));
112112
}
113113
Err(err)
@@ -207,16 +207,6 @@ pub(crate) fn cli() -> Command<'static> {
207207
.arg(
208208
verbose_arg("Enable verbose output"),
209209
)
210-
.help_template(
211-
"\
212-
{name} {version}
213-
{about}
214-
215-
USAGE:
216-
{usage}
217-
218-
{all-args}",
219-
)
220210
.arg(
221211
Arg::new("quiet")
222212
.conflicts_with("verbose")
@@ -351,7 +341,6 @@ USAGE:
351341
Arg::new("toolchain")
352342
.help(TOOLCHAIN_ARG_HELP)
353343
.required(false)
354-
.takes_value(true),
355344
),
356345
)
357346
.subcommand(
@@ -392,7 +381,7 @@ USAGE:
392381
.takes_value(true)
393382
.multiple_values(true)
394383
.use_value_delimiter(true)
395-
.action(ArgAction::Append),
384+
.action(ArgAction::Append),
396385
)
397386
.arg(
398387
Arg::new("targets")
@@ -401,8 +390,8 @@ USAGE:
401390
.short('t')
402391
.takes_value(true)
403392
.multiple_values(true)
404-
.multiple_occurrences(true)
405-
.use_value_delimiter(true),
393+
.use_value_delimiter(true)
394+
.action(ArgAction::Append),
406395
)
407396
.arg(
408397
Arg::new("no-self-update")
@@ -1520,7 +1509,7 @@ fn override_remove(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
15201509
info!("override toolchain for '{}' removed", path);
15211510
} else {
15221511
info!("no override toolchain for '{}'", path);
1523-
if !m.get_one::<String>("path").is_some() && !m.get_flag("nonexistent") {
1512+
if m.get_one::<String>("path").is_none() && !m.get_flag("nonexistent") {
15241513
info!(
15251514
"you may use `--path <path>` option to remove override toolchain \
15261515
for a specific path"

tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Check for updates to Rust toolchains and rustup
77
USAGE:
88
rustup[EXE] check
99
10-
FLAGS:
11-
-h, --help Prints help information
10+
OPTIONS:
11+
-h, --help Print help information
12+
1213
"""
1314
stderr = ""

tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ Generate tab-completion scripts for your shell
77
USAGE:
88
rustup[EXE] completions [ARGS]
99
10-
FLAGS:
11-
-h, --help Prints help information
12-
1310
ARGS:
14-
<shell> [possible values: zsh, bash, fish, powershell, elvish]
15-
<command> [possible values: rustup, cargo]
11+
<shell> [possible values: bash, elvish, fish, powershell, zsh]
12+
<command> [possible values: rustup, cargo]
13+
14+
OPTIONS:
15+
-h, --help Print help information
1616
1717
DISCUSSION:
1818
Enable tab completion for Bash, Fish, Zsh, or PowerShell
@@ -134,5 +134,6 @@ ${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
134134
ZSH:
135135
136136
$ rustup completions zsh cargo > ~/.zfunc/_cargo
137+
137138
"""
138139
stderr = ""

tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ Add a component to a Rust toolchain
77
USAGE:
88
rustup[EXE] component add [OPTIONS] <component>...
99
10-
FLAGS:
11-
-h, --help Prints help information
10+
ARGS:
11+
<component>...
1212
1313
OPTIONS:
14+
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more
15+
information see `rustup help toolchain`
1416
--target <target>
15-
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
16-
`rustup help toolchain`
17+
-h, --help Print help information
1718
18-
ARGS:
19-
<component>...
2019
"""
2120
stderr = ""

tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ stdout = """
55
List installed and available components
66
77
USAGE:
8-
rustup[EXE] component list [FLAGS] [OPTIONS]
9-
10-
FLAGS:
11-
-h, --help Prints help information
12-
--installed List only installed components
8+
rustup[EXE] component list [OPTIONS]
139
1410
OPTIONS:
15-
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
16-
`rustup help toolchain`
11+
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more
12+
information see `rustup help toolchain`
13+
--installed List only installed components
14+
-h, --help Print help information
15+
1716
"""
1817
stderr = ""

tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ Remove a component from a Rust toolchain
77
USAGE:
88
rustup[EXE] component remove [OPTIONS] <component>...
99
10-
FLAGS:
11-
-h, --help Prints help information
10+
ARGS:
11+
<component>...
1212
1313
OPTIONS:
14+
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more
15+
information see `rustup help toolchain`
1416
--target <target>
15-
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
16-
`rustup help toolchain`
17+
-h, --help Print help information
1718
18-
ARGS:
19-
<component>...
2019
"""
2120
stderr = ""

tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ Set the default toolchain
77
USAGE:
88
rustup[EXE] default [toolchain]
99
10-
FLAGS:
11-
-h, --help Prints help information
12-
1310
ARGS:
14-
<toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help
15-
toolchain`
11+
<toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information
12+
see `rustup help toolchain`
13+
14+
OPTIONS:
15+
-h, --help Print help information
1616
1717
DISCUSSION:
1818
Sets the default toolchain to the one specified. If the toolchain
1919
is not already installed then it is installed first.
20+
2021
"""
2122
stderr = ""

tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,42 @@ stdout = """
55
Open the documentation for the current toolchain
66
77
USAGE:
8-
rustup[EXE] doc [FLAGS] [OPTIONS] [topic]
8+
rustup[EXE] doc [OPTIONS] [topic]
99
10-
FLAGS:
11-
--alloc The Rust core allocation and collections library
12-
--book The Rust Programming Language book
13-
--cargo The Cargo Book
14-
--core The Rust Core Library
15-
--edition-guide The Rust Edition Guide
16-
--embedded-book The Embedded Rust Book
17-
-h, --help Prints help information
18-
--nomicon The Dark Arts of Advanced and Unsafe Rust Programming
19-
--path Only print the path to the documentation
20-
--proc_macro A support library for macro authors when defining new macros
21-
--reference The Rust Reference
22-
--rust-by-example A collection of runnable examples that illustrate various Rust concepts and standard
23-
libraries
24-
--rustc The compiler for the Rust programming language
25-
--rustdoc Documentation generator for Rust projects
26-
--std Standard library API documentation
27-
--test Support code for rustc's built in unit-test and micro-benchmarking framework
28-
--unstable-book The Unstable Book
10+
ARGS:
11+
<topic> Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!',
12+
'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum',
13+
'std::io::error::Result' etc...
2914
3015
OPTIONS:
31-
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
32-
`rustup help toolchain`
33-
34-
ARGS:
35-
<topic> Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs',
36-
'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...
16+
--path Only print the path to the documentation
17+
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more
18+
information see `rustup help toolchain`
19+
--alloc The Rust core allocation and collections library
20+
--book The Rust Programming Language book
21+
--cargo The Cargo Book
22+
--core The Rust Core Library
23+
--edition-guide The Rust Edition Guide
24+
--nomicon The Dark Arts of Advanced and Unsafe Rust Programming
25+
--proc_macro A support library for macro authors when defining new macros
26+
--reference The Rust Reference
27+
--rust-by-example A collection of runnable examples that illustrate various Rust
28+
concepts and standard libraries
29+
--rustc The compiler for the Rust programming language
30+
--rustdoc Documentation generator for Rust projects
31+
--std Standard library API documentation
32+
--test Support code for rustc's built in unit-test and
33+
micro-benchmarking framework
34+
--unstable-book The Unstable Book
35+
--embedded-book The Embedded Rust Book
36+
-h, --help Print help information
3737
3838
DISCUSSION:
3939
Opens the documentation for the currently active toolchain with
4040
the default browser.
4141
4242
By default, it opens the documentation index. Use the various
4343
flags to open specific pieces of documentation.
44+
4445
"""
4546
stderr = ""

tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ rustup [..]
66
The Rust toolchain installer
77
88
USAGE:
9-
rustup[EXE] [FLAGS] [+toolchain] <SUBCOMMAND>
10-
11-
FLAGS:
12-
-v, --verbose Enable verbose output
13-
-q, --quiet Disable progress output
14-
-h, --help Prints help information
15-
-V, --version Prints version information
9+
rustup[EXE] [OPTIONS] [+toolchain] [SUBCOMMAND]
1610
1711
ARGS:
1812
<+toolchain> release channel (e.g. +stable) or custom toolchain to set override
1913
14+
OPTIONS:
15+
-v, --verbose Enable verbose output
16+
-q, --quiet Disable progress output
17+
-h, --help Print help information
18+
-V, --version Print version information
19+
2020
SUBCOMMANDS:
2121
show Show the active and installed toolchains or profiles
2222
update Update Rust toolchains and rustup
@@ -33,7 +33,7 @@ SUBCOMMANDS:
3333
self Modify the rustup installation
3434
set Alter rustup settings
3535
completions Generate tab-completion scripts for your shell
36-
help Prints this message or the help of the given subcommand(s)
36+
help Print this message or the help of the given subcommand(s)
3737
3838
DISCUSSION:
3939
Rustup installs The Rust Programming Language from the official
@@ -44,5 +44,6 @@ DISCUSSION:
4444
4545
If you are new to Rust consider running `rustup doc --book` to
4646
learn Rust.
47+
4748
"""
4849
stderr = ""

tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ rustup [..]
66
The Rust toolchain installer
77
88
USAGE:
9-
rustup[EXE] [FLAGS] [+toolchain] <SUBCOMMAND>
10-
11-
FLAGS:
12-
-v, --verbose Enable verbose output
13-
-q, --quiet Disable progress output
14-
-h, --help Prints help information
15-
-V, --version Prints version information
9+
rustup[EXE] [OPTIONS] [+toolchain] [SUBCOMMAND]
1610
1711
ARGS:
1812
<+toolchain> release channel (e.g. +stable) or custom toolchain to set override
1913
14+
OPTIONS:
15+
-v, --verbose Enable verbose output
16+
-q, --quiet Disable progress output
17+
-h, --help Print help information
18+
-V, --version Print version information
19+
2020
SUBCOMMANDS:
2121
show Show the active and installed toolchains or profiles
2222
update Update Rust toolchains and rustup
@@ -33,7 +33,7 @@ SUBCOMMANDS:
3333
self Modify the rustup installation
3434
set Alter rustup settings
3535
completions Generate tab-completion scripts for your shell
36-
help Prints this message or the help of the given subcommand(s)
36+
help Print this message or the help of the given subcommand(s)
3737
3838
DISCUSSION:
3939
Rustup installs The Rust Programming Language from the official
@@ -44,5 +44,6 @@ DISCUSSION:
4444
4545
If you are new to Rust consider running `rustup doc --book` to
4646
learn Rust.
47+
4748
"""
4849
stderr = ""

0 commit comments

Comments
 (0)