Skip to content

Commit eda23b6

Browse files
committed
Address failing test
...by being smarter about finding components from binary names
1 parent 79c0312 commit eda23b6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/rustup/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ pub static TOOLS: &'static [&'static str] = &[
3939
pub static DUP_TOOLS: &'static [&'static str] = &["rustfmt", "cargo-fmt"];
4040

4141
fn component_for_bin(binary: &str) -> Option<&'static str> {
42-
match binary {
42+
use std::env::consts::EXE_SUFFIX;
43+
44+
let binary_prefix = match binary.find(EXE_SUFFIX) {
45+
_ if EXE_SUFFIX.is_empty() => binary,
46+
Some(i) => &binary[..i],
47+
None => binary,
48+
};
49+
50+
match binary_prefix {
4351
"rustc" | "rustdoc" => Some("rustc"),
4452
"cargo" => Some("cargo"),
4553
"rust-lldb" => Some("lldb-preview"),

0 commit comments

Comments
 (0)