mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Spot the typo easily
This commit is contained in:
parent
cc80b40f1c
commit
671ba3fdfe
@ -285,11 +285,7 @@ pub(super) fn activation_error(
|
|||||||
.collect();
|
.collect();
|
||||||
candidates.sort_by_key(|o| o.0);
|
candidates.sort_by_key(|o| o.0);
|
||||||
let mut msg = format!(
|
let mut msg = format!(
|
||||||
"no matching package named `{}` found\n\
|
"no matching package named `{}` found\n", dep.package_name());
|
||||||
location searched: {}\n",
|
|
||||||
dep.package_name(),
|
|
||||||
dep.source_id()
|
|
||||||
);
|
|
||||||
if !candidates.is_empty() {
|
if !candidates.is_empty() {
|
||||||
// If dependency package name is equal to the name of the candidate here
|
// If dependency package name is equal to the name of the candidate here
|
||||||
// it may be a prerelease package which hasn't been specified correctly
|
// it may be a prerelease package which hasn't been specified correctly
|
||||||
@ -312,8 +308,9 @@ pub(super) fn activation_error(
|
|||||||
if candidates.len() > 3 {
|
if candidates.len() > 3 {
|
||||||
names.push("...");
|
names.push("...");
|
||||||
}
|
}
|
||||||
|
// Vertically align first suggestion with missing crate name
|
||||||
msg.push_str("perhaps you meant: ");
|
// so the silly typo you probably made jumps out at you.
|
||||||
|
msg.push_str("perhaps you meant: ");
|
||||||
msg.push_str(&names.iter().enumerate().fold(
|
msg.push_str(&names.iter().enumerate().fold(
|
||||||
String::default(),
|
String::default(),
|
||||||
|acc, (i, el)| match i {
|
|acc, (i, el)| match i {
|
||||||
@ -323,9 +320,9 @@ pub(super) fn activation_error(
|
|||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.push('\n');
|
msg.push('\n');
|
||||||
}
|
}
|
||||||
|
msg.push_str(&format!("location searched: {}\n", dep.source_id()));
|
||||||
msg.push_str("required by ");
|
msg.push_str("required by ");
|
||||||
msg.push_str(&describe_path(
|
msg.push_str(&describe_path(
|
||||||
&cx.parents.path_to_bottom(&parent.package_id()),
|
&cx.parents.path_to_bottom(&parent.package_id()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user