Skip to content

Commit 0bcf123

Browse files
committed
feat(rustup_mode): revise help message
to suggest command to install missing components. make them more consistent.
1 parent 07437e7 commit 0bcf123

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
@@ -705,7 +705,7 @@ async fn run_rls_when_not_installed() {
705705
.await
706706
.with_stderr(snapbox::str![[r#"
707707
error: 'rls[EXE]' is not installed for the toolchain 'stable-[HOST_TRIPLE]'.
708-
To install, run `rustup component add rls`
708+
help: run `rustup component add rls` to install it
709709
710710
"#]])
711711
.is_err();
@@ -727,7 +727,7 @@ async fn run_rls_when_not_installed_for_nightly() {
727727
.await
728728
.with_stderr(snapbox::str![[r#"
729729
error: 'rls[EXE]' is not installed for the toolchain 'nightly-[HOST_TRIPLE]'.
730-
To install, run `rustup component add --toolchain nightly-[HOST_TRIPLE] rls`
730+
help: run `rustup component add --toolchain nightly-[HOST_TRIPLE] rls` to install it
731731
732732
"#]])
733733
.is_err();
@@ -1403,7 +1403,7 @@ async fn which_asking_uninstalled_components() {
14031403
.await
14041404
.with_stderr(snapbox::str![[r#"
14051405
error: 'rustfmt' is not installed for the toolchain 'custom-1'.
1406-
[..]`rustup component add rustfmt`
1406+
[..]`rustup component add rustfmt`[..]
14071407
14081408
"#]])
14091409
.is_err();
@@ -1419,7 +1419,7 @@ error: 'rustfmt' is not installed for the toolchain 'custom-1'.
14191419
.await
14201420
.with_stderr(snapbox::str![[r#"
14211421
[..]'rustfmt' is not installed for the toolchain 'custom-2'.
1422-
[..]`rustup component add --toolchain custom-2 rustfmt`
1422+
[..]`rustup component add --toolchain custom-2 rustfmt`[..]
14231423
14241424
"#]])
14251425
.is_err();

tests/suite/cli_rustup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3342,7 +3342,7 @@ async fn docs_missing() {
33423342
.await
33433343
.with_stderr(snapbox::str![[r#"
33443344
info: `rust-docs` not installed in toolchain `nightly-[HOST_TRIPLE]`
3345-
info: To install, try `rustup component add --toolchain nightly-[HOST_TRIPLE] rust-docs`
3345+
help: run `rustup component add --toolchain nightly-[HOST_TRIPLE] rust-docs` to install it
33463346
error: unable to view documentation which is not installed
33473347
33483348
"#]])

tests/suite/cli_self_upd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ async fn rls_proxy_set_up_after_install() {
10201020
.await
10211021
.with_stderr(snapbox::str![[r#"
10221022
error: 'rls[EXE]' is not installed for the toolchain 'stable-[HOST_TRIPLE]'.
1023-
To install, run `rustup component add rls`
1023+
help: run `rustup component add rls` to install it
10241024
10251025
"#]])
10261026
.is_err();

0 commit comments

Comments
 (0)