mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
refactor(compile): Make unmatched_packages optional
This commit is contained in:
parent
02ec8d48e5
commit
981ea84bdc
@ -294,16 +294,16 @@ impl<'a> UnitGenerator<'a, '_> {
|
||||
|
||||
let unmatched_packages = match self.spec {
|
||||
Packages::Default | Packages::OptOut(_) | Packages::All(_) => {
|
||||
"default-run packages".to_owned()
|
||||
" in default-run packages".to_owned()
|
||||
}
|
||||
Packages::Packages(packages) => {
|
||||
let first = packages
|
||||
.first()
|
||||
.expect("The number of packages must be at least 1");
|
||||
if packages.len() == 1 {
|
||||
format!("`{}` package", first)
|
||||
format!(" in `{}` package", first)
|
||||
} else {
|
||||
format!("`{}`, ... packages", first)
|
||||
format!(" in `{}`, ... packages", first)
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -313,7 +313,7 @@ impl<'a> UnitGenerator<'a, '_> {
|
||||
let mut msg = String::new();
|
||||
write!(
|
||||
msg,
|
||||
"no {target_desc} target {named} `{target_name}` in {unmatched_packages}{suggestion}",
|
||||
"no {target_desc} target {named} `{target_name}`{unmatched_packages}{suggestion}",
|
||||
)?;
|
||||
if !targets_elsewhere.is_empty() {
|
||||
append_targets_elsewhere(&mut msg)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user