Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions crates/prek/src/languages/rust/rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::path::{Path, PathBuf};
use std::sync::LazyLock;

use anyhow::{Context, Result};
use futures::{StreamExt, TryStreamExt};
use futures::StreamExt;
use prek_consts::env_vars::EnvVars;
use semver::Version;
use target_lexicon::HOST;
use tracing::{debug, trace};
use tracing::{debug, trace, warn};

use crate::fs::LockedFile;
use crate::languages::REQWEST_CLIENT;
Expand Down Expand Up @@ -182,8 +182,15 @@ impl Rustup {
let infos: Vec<ToolchainInfo> = futures::stream::iter(entries)
.map(async move |(name, path)| toolchain_info(name, path).await)
.buffer_unordered(8)
.try_collect()
.await?;
.filter_map(async move |result| match result {
Ok(info) => Some(info),
Err(e) => {
warn!("Skipping invalid toolchain: {e:#}");
None
}
})
.collect()
.await;

Ok(infos)
}
Expand All @@ -208,8 +215,15 @@ impl Rustup {
let infos: Vec<ToolchainInfo> = futures::stream::iter(entries)
.map(async move |(name, path)| toolchain_info(name, path).await)
.buffer_unordered(8)
.try_collect()
.await?;
.filter_map(async move |result| match result {
Ok(info) => Some(info),
Err(e) => {
warn!("Skipping invalid toolchain: {e:#}");
None
}
})
.collect()
.await;

Ok(infos)
}
Expand Down
Loading