Skip to content

Commit af4d475

Browse files
authored
Merge pull request #1769 from kinnison/kinnison/better-error-no-toolchain
errors: Reorder component-unavailable message parts
2 parents 23a13d5 + 928e768 commit af4d475

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/errors.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ use std::path::PathBuf;
1010
use url::Url;
1111

1212
pub const TOOLSTATE_MSG: &str =
13-
"if you require these components, please install and use the latest successful build version, \
14-
which you can find at https://rust-lang-nursery.github.io/rust-toolstate, for example.\n\
15-
rustup install nightly-2018-12-27";
13+
"If you require these components, please install and use the latest successful build version,\n\
14+
which you can find at https://rust-lang-nursery.github.io/rust-toolstate.\n\nAfter determining \
15+
the correct date, install it with a command such as:\n\n \
16+
rustup toolchain install nightly-2018-12-27\n\n\
17+
Then you can use the toolchain with commands such as:\n\n \
18+
cargo +nightly-2018-12-27 build";
1619

1720
error_chain! {
1821
links {
@@ -267,7 +270,7 @@ error_chain! {
267270
}
268271
RequestedComponentsUnavailable(c: Vec<Component>, manifest: Manifest, toolchain: String) {
269272
description("some requested components are unavailable to download")
270-
display("{} for channel '{}'", component_unavailable_msg(&c, &manifest), toolchain)
273+
display("{} for channel '{}'\n{}", component_unavailable_msg(&c, &manifest), toolchain, TOOLSTATE_MSG)
271274
}
272275
UnknownMetadataVersion(v: String) {
273276
description("unknown metadata version")
@@ -341,19 +344,11 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest) -> String {
341344
if same_target {
342345
let mut cs_strs = cs.iter().map(|c| format!("'{}'", c.short_name(manifest)));
343346
let cs_str = cs_strs.join(", ");
344-
let _ = write!(
345-
buf,
346-
"some components unavailable for download: {}\n{}",
347-
cs_str, TOOLSTATE_MSG,
348-
);
347+
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
349348
} else {
350349
let mut cs_strs = cs.iter().map(|c| c.description(manifest));
351350
let cs_str = cs_strs.join(", ");
352-
let _ = write!(
353-
buf,
354-
"some components unavailable for download: {}\n{}",
355-
cs_str, TOOLSTATE_MSG,
356-
);
351+
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
357352
}
358353
}
359354

tests/cli-misc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ fn update_unavailable_rustc() {
699699
config,
700700
&["rustup", "update", "nightly"],
701701
format!(
702-
"some components unavailable for download: 'rustc', 'cargo'\n{}",
702+
"some components unavailable for download: 'rustc', 'cargo' for channel 'nightly'\n{}",
703703
TOOLSTATE_MSG
704704
)
705705
.as_str(),

0 commit comments

Comments
 (0)