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:
Ed Page 2024-09-18 09:20:22 -05:00
parent 9d5c1497f6
commit 397a18076a

View File

@ -1123,11 +1123,13 @@ fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
if is_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() {
candidates.extend(targets);
candidates = targets;
}
}