mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(complete): Fallback to rustc if rustup fails for --target completions
If there is any problem with rustup, we should fallback to rustc. (this also removes some extra allocations)
This commit is contained in:
parent
9d5c1497f6
commit
397a18076a
@ -1123,11 +1123,13 @@ fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
|
|||||||
|
|
||||||
if is_rustup() {
|
if is_rustup() {
|
||||||
if let Ok(targets) = get_target_triples_from_rustup() {
|
if let Ok(targets) = get_target_triples_from_rustup() {
|
||||||
candidates.extend(targets);
|
candidates = targets;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if candidates.is_empty() {
|
||||||
if let Ok(targets) = get_target_triples_from_rustc() {
|
if let Ok(targets) = get_target_triples_from_rustc() {
|
||||||
candidates.extend(targets);
|
candidates = targets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user