xtask: filter toolchains before .find()

This commit is contained in:
Alex Janka 2024-08-19 11:49:43 +10:00
parent bec9b0f57b
commit f808a58492
2 changed files with 1 additions and 8 deletions

View file

@ -156,14 +156,6 @@ fn platform_triples<'a>(
architectures
.iter()
.filter_map(|architecture| get_triple(*platform, *architecture).map(|v| v.triple))
.filter(|triple| {
if is_toolchain_installed(triple) {
true
} else {
log::warn!("toolchain not installed for {triple} - skipping");
false
}
})
}
fn platforms_and_triples(

View file

@ -42,6 +42,7 @@ pub fn get_triple(
) -> Option<cfg_expr::targets::TargetInfo> {
cfg_expr::targets::ALL_BUILTINS
.iter()
.filter(|t| crate::is_toolchain_installed(&t.triple))
.find(|b| {
b.matches(&cfg_expr::TargetPredicate::Arch(architecture.as_cargo()))
&& b.matches(&cfg_expr::TargetPredicate::Os(platform.as_cargo()))