Skip to content

Commit e632c8f

Browse files
committed
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)
1 parent 0461165 commit e632c8f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,13 @@ fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
11011101

11021102
if is_rustup() {
11031103
if let Ok(targets) = get_target_triples_from_rustup() {
1104-
candidates.extend(targets);
1104+
candidates = targets;
11051105
}
1106-
} else {
1106+
}
1107+
1108+
if candidates.is_empty() {
11071109
if let Ok(targets) = get_target_triples_from_rustc() {
1108-
candidates.extend(targets);
1110+
candidates = targets;
11091111
}
11101112
}
11111113

0 commit comments

Comments
 (0)