Skip to content

Commit 7a9e227

Browse files
Bogayrami3l
authored andcommitted
feat(rustup_mode): revise help message
to suggest command to install missing components. make them more consistent.
1 parent 30318d5 commit 7a9e227

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

src/cli/rustup_mode.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ async fn which(
10451045
};
10461046

10471047
Err(anyhow!(
1048-
"'{binary}' is not installed for the toolchain '{toolchain_name}'.\nTo install, run `rustup component add {selector}{component_name}`"
1048+
"'{binary}' is not installed for the toolchain '{toolchain_name}'.\nhelp: run `rustup component add {selector}{component_name}` to install it"
10491049
))
10501050
}
10511051

@@ -1714,11 +1714,8 @@ async fn doc(
17141714
.as_slice()
17151715
{
17161716
info!(
1717-
"`rust-docs` not installed in toolchain `{}`",
1718-
distributable.desc()
1719-
);
1720-
info!(
1721-
"To install, try `rustup component add --toolchain {} rust-docs`",
1717+
"`rust-docs` not installed in toolchain `{}`\nhelp: run `rustup component add --toolchain {} rust-docs` to install it",
1718+
distributable.desc(),
17221719
distributable.desc()
17231720
);
17241721
return Err(anyhow!(

src/toolchain/distributable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'a> DistributableToolchain<'a> {
453453
_ => format!("--toolchain {} ", self.toolchain.name()),
454454
};
455455
Err(anyhow!(
456-
"'{binary_lossy}' is not installed for the toolchain '{desc}'.\nTo install, run `rustup component add {selector}{component_name}`"
456+
"'{binary_lossy}' is not installed for the toolchain '{desc}'.\nhelp: run `rustup component add {selector}{component_name}` to install it"
457457
))
458458
}
459459
} else {

tests/suite/cli_misc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ async fn run_rls_when_not_installed() {
711711
.await
712712
.with_stderr(snapbox::str![[r#"
713713
error: 'rls[EXE]' is not installed for the toolchain 'stable-[HOST_TRIPLE]'.
714-
To install, run `rustup component add rls`
714+
help: run `rustup component add rls` to install it
715715
716716
"#]])
717717
.is_err();
@@ -733,7 +733,7 @@ async fn run_rls_when_not_installed_for_nightly() {
733733
.await
734734
.with_stderr(snapbox::str![[r#"
735735
error: 'rls[EXE]' is not installed for the toolchain 'nightly-[HOST_TRIPLE]'.
736-
To install, run `rustup component add --toolchain nightly-[HOST_TRIPLE] rls`
736+
help: run `rustup component add --toolchain nightly-[HOST_TRIPLE] rls` to install it
737737
738738
"#]])
739739
.is_err();
@@ -1409,7 +1409,7 @@ async fn which_asking_uninstalled_components() {
14091409
.await
14101410
.with_stderr(snapbox::str![[r#"
14111411
error: 'rustfmt' is not installed for the toolchain 'custom-1'.
1412-
[..]`rustup component add rustfmt`
1412+
[..]`rustup component add rustfmt`[..]
14131413
14141414
"#]])
14151415
.is_err();
@@ -1425,7 +1425,7 @@ error: 'rustfmt' is not installed for the toolchain 'custom-1'.
14251425
.await
14261426
.with_stderr(snapbox::str![[r#"
14271427
[..]'rustfmt' is not installed for the toolchain 'custom-2'.
1428-
[..]`rustup component add --toolchain custom-2 rustfmt`
1428+
[..]`rustup component add --toolchain custom-2 rustfmt`[..]
14291429
14301430
"#]])
14311431
.is_err();

tests/suite/cli_rustup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3373,7 +3373,7 @@ async fn docs_missing() {
33733373
.await
33743374
.with_stderr(snapbox::str![[r#"
33753375
info: `rust-docs` not installed in toolchain `nightly-[HOST_TRIPLE]`
3376-
info: To install, try `rustup component add --toolchain nightly-[HOST_TRIPLE] rust-docs`
3376+
help: run `rustup component add --toolchain nightly-[HOST_TRIPLE] rust-docs` to install it
33773377
error: unable to view documentation which is not installed
33783378
33793379
"#]])

tests/suite/cli_self_upd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ async fn rls_proxy_set_up_after_install() {
10081008
.await
10091009
.with_stderr(snapbox::str![[r#"
10101010
error: 'rls[EXE]' is not installed for the toolchain 'stable-[HOST_TRIPLE]'.
1011-
To install, run `rustup component add rls`
1011+
help: run `rustup component add rls` to install it
10121012
10131013
"#]])
10141014
.is_err();

0 commit comments

Comments
 (0)