Skip to content

errors: Reorder component-unavailable message parts #1769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ use std::path::PathBuf;
use url::Url;

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

error_chain! {
links {
Expand Down Expand Up @@ -267,7 +270,7 @@ error_chain! {
}
RequestedComponentsUnavailable(c: Vec<Component>, manifest: Manifest, toolchain: String) {
description("some requested components are unavailable to download")
display("{} for channel '{}'", component_unavailable_msg(&c, &manifest), toolchain)
display("{} for channel '{}'\n{}", component_unavailable_msg(&c, &manifest), toolchain, TOOLSTATE_MSG)
}
UnknownMetadataVersion(v: String) {
description("unknown metadata version")
Expand Down Expand Up @@ -341,19 +344,11 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest) -> String {
if same_target {
let mut cs_strs = cs.iter().map(|c| format!("'{}'", c.short_name(manifest)));
let cs_str = cs_strs.join(", ");
let _ = write!(
buf,
"some components unavailable for download: {}\n{}",
cs_str, TOOLSTATE_MSG,
);
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
} else {
let mut cs_strs = cs.iter().map(|c| c.description(manifest));
let cs_str = cs_strs.join(", ");
let _ = write!(
buf,
"some components unavailable for download: {}\n{}",
cs_str, TOOLSTATE_MSG,
);
let _ = write!(buf, "some components unavailable for download: {}", cs_str,);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cli-misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ fn update_unavailable_rustc() {
config,
&["rustup", "update", "nightly"],
format!(
"some components unavailable for download: 'rustc', 'cargo'\n{}",
"some components unavailable for download: 'rustc', 'cargo' for channel 'nightly'\n{}",
TOOLSTATE_MSG
)
.as_str(),
Expand Down