diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 6bb219bcf23..3069a379971 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -1121,13 +1121,13 @@ fn get_targets_from_metadata() -> CargoResult> { fn get_target_triples() -> Vec { let mut candidates = Vec::new(); - if is_rustup() { - if let Ok(targets) = get_target_triples_from_rustup() { - candidates.extend(targets); - } - } else { + if let Ok(targets) = get_target_triples_from_rustup() { + candidates = targets; + } + + if candidates.is_empty() { if let Ok(targets) = get_target_triples_from_rustc() { - candidates.extend(targets); + candidates = targets; } }