Skip to content

Commit a5c25f3

Browse files
committed
fix(complete): Always check rustup for --target
clap-rs/clap#5733 removed the rustup proxy so that `CARGO_COMPLETE=bash cargo +nightly` works (with a side benefit of removing the proxy overhead). As a downside, cargo no longer knows it is running within rustup, so we aren't reading `--target` candidates from rustup. This changes the code to always try rustup. It is likely a good enough source, even if the user isn't currently using it. The candidates should be about the same, just rustup hides some by default. Hiding just means it isn't shown by default but if only hidden candidates match, then we show them.
1 parent 397a180 commit a5c25f3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,10 +1121,8 @@ 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 = targets;
1127-
}
1124+
if let Ok(targets) = get_target_triples_from_rustup() {
1125+
candidates = targets;
11281126
}
11291127

11301128
if candidates.is_empty() {

0 commit comments

Comments
 (0)