mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 12:38:43 +00:00
Refactor: Extract target::linux::create_targets_str
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
7997c73cb2
commit
a686aca08c
1 changed files with 9 additions and 10 deletions
|
@ -139,12 +139,7 @@ mod linux {
|
|||
// Glibc can only be dynamically linked.
|
||||
// If we can run this binary, then it means that the target
|
||||
// supports both glibc and musl.
|
||||
Libc::Glibc => {
|
||||
return vec![
|
||||
create_target_str("gnu", abi),
|
||||
create_target_str("musl", abi),
|
||||
]
|
||||
}
|
||||
Libc::Glibc => return create_targets_str(&["gnu", "musl"], abi),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
@ -164,10 +159,7 @@ mod linux {
|
|||
};
|
||||
|
||||
if libc_version == "gnu" {
|
||||
return vec![
|
||||
create_target_str("gnu", abi),
|
||||
create_target_str("musl", abi),
|
||||
];
|
||||
return create_targets_str(&["gnu", "musl"], abi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,6 +203,13 @@ mod linux {
|
|||
|
||||
format!("{prefix}-{libc_version}{abi}")
|
||||
}
|
||||
|
||||
fn create_targets_str(libc_versions: &[&str], abi: &str) -> Vec<String> {
|
||||
libc_version
|
||||
.iter()
|
||||
.map(|libc_version| create_target_str(libc_version, abi))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
Loading…
Add table
Reference in a new issue