Skip to content

Commit ecd8b59

Browse files
committed
errors: Reorder component-unavailable message parts
The ordering of some of the parts of the component-unavailable error message was unfortunate, resulting in confusion. This reorders those so that errors are slightly clearer. Fixes: #1768 Signed-off-by: Daniel Silverstone <[email protected]>
1 parent 5d1db84 commit ecd8b59

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/errors.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ error_chain! {
267267
}
268268
RequestedComponentsUnavailable(c: Vec<Component>, manifest: Manifest, toolchain: String) {
269269
description("some requested components are unavailable to download")
270-
display("{} for channel '{}'", component_unavailable_msg(&c, &manifest), toolchain)
270+
display("{} for channel '{}'\n{}", component_unavailable_msg(&c, &manifest), toolchain, TOOLSTATE_MSG)
271271
}
272272
UnknownMetadataVersion(v: String) {
273273
description("unknown metadata version")
@@ -341,19 +341,11 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest) -> String {
341341
if same_target {
342342
let mut cs_strs = cs.iter().map(|c| format!("'{}'", c.short_name(manifest)));
343343
let cs_str = cs_strs.join(", ");
344-
let _ = write!(
345-
buf,
346-
"some components unavailable for download: {}\n{}",
347-
cs_str, TOOLSTATE_MSG,
348-
);
344+
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
349345
} else {
350346
let mut cs_strs = cs.iter().map(|c| c.description(manifest));
351347
let cs_str = cs_strs.join(", ");
352-
let _ = write!(
353-
buf,
354-
"some components unavailable for download: {}\n{}",
355-
cs_str, TOOLSTATE_MSG,
356-
);
348+
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
357349
}
358350
}
359351

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)