Skip to content

Commit eaee77d

Browse files
committed
Auto merge of #14564 - epage:rustup, r=weihanglo
fix(complete): Harden `--target` completions ### What does this PR try to resolve? I found `--target` wasn't working with rustup as I expected, so this fixes it. We generally only reference rustup if we are running under it but I think in UX code like this, with a fallback scheme, this should be reasonable enough. ### How should we test and review this PR? ### Additional information
2 parents 9d5c149 + a5c25f3 commit eaee77d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cargo/util/command_prelude.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1121,13 +1121,13 @@ fn get_targets_from_metadata() -> CargoResult<Vec<Target>> {
11211121
fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
11221122
let mut candidates = Vec::new();
11231123

1124-
if is_rustup() {
1125-
if let Ok(targets) = get_target_triples_from_rustup() {
1126-
candidates.extend(targets);
1127-
}
1128-
} else {
1124+
if let Ok(targets) = get_target_triples_from_rustup() {
1125+
candidates = targets;
1126+
}
1127+
1128+
if candidates.is_empty() {
11291129
if let Ok(targets) = get_target_triples_from_rustc() {
1130-
candidates.extend(targets);
1130+
candidates = targets;
11311131
}
11321132
}
11331133

0 commit comments

Comments
 (0)