mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Replace |...| async move
with async |...|
This commit is contained in:
parent
959e385d58
commit
475a48d6d3
6 changed files with 12 additions and 15 deletions
|
@ -106,7 +106,7 @@ impl<'a> FlatIndexClient<'a> {
|
|||
indexes: impl Iterator<Item = &IndexUrl>,
|
||||
) -> Result<FlatIndexEntries, FlatIndexError> {
|
||||
let mut fetches = futures::stream::iter(indexes)
|
||||
.map(|index| async move {
|
||||
.map(async |index| {
|
||||
let entries = match index {
|
||||
IndexUrl::Path(url) => {
|
||||
let path = url
|
||||
|
|
|
@ -274,7 +274,7 @@ impl RegistryClient {
|
|||
// Otherwise, fetch concurrently.
|
||||
IndexStrategy::UnsafeBestMatch | IndexStrategy::UnsafeFirstMatch => {
|
||||
results = futures::stream::iter(it)
|
||||
.map(|index| async move {
|
||||
.map(async |index| {
|
||||
let _permit = download_concurrency.acquire().await;
|
||||
let metadata = self
|
||||
.simple_single_index(package_name, index, capabilities)
|
||||
|
@ -282,12 +282,10 @@ impl RegistryClient {
|
|||
Ok((index, metadata))
|
||||
})
|
||||
.buffered(8)
|
||||
.filter_map(|result: Result<_, Error>| async move {
|
||||
match result {
|
||||
Ok((index, Some(metadata))) => Some(Ok((index, metadata))),
|
||||
Ok((_, None)) => None,
|
||||
Err(err) => Some(Err(err)),
|
||||
}
|
||||
.filter_map(async |result: Result<_, Error>| match result {
|
||||
Ok((index, Some(metadata))) => Some(Ok((index, metadata))),
|
||||
Ok((_, None)) => None,
|
||||
Err(err) => Some(Err(err)),
|
||||
})
|
||||
.try_collect::<Vec<_>>()
|
||||
.await?;
|
||||
|
|
|
@ -734,7 +734,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
Ok(revision)
|
||||
} else {
|
||||
client
|
||||
.managed(|client| async move {
|
||||
.managed(async |client| {
|
||||
client
|
||||
.cached_client()
|
||||
.skip_cache_with_retry(
|
||||
|
@ -2019,7 +2019,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
.instrument(info_span!("download", source_dist = %source))
|
||||
};
|
||||
client
|
||||
.managed(|client| async move {
|
||||
.managed(async |client| {
|
||||
client
|
||||
.cached_client()
|
||||
.skip_cache_with_retry(
|
||||
|
|
|
@ -70,7 +70,7 @@ impl<'a, Context: BuildContext> Preparer<'a, Context> {
|
|||
) -> impl Stream<Item = Result<CachedDist, Error>> + 'stream {
|
||||
distributions
|
||||
.into_iter()
|
||||
.map(|dist| async move {
|
||||
.map(async |dist| {
|
||||
let wheel = self
|
||||
.get_wheel((*dist).clone(), in_flight, resolution)
|
||||
.boxed_local()
|
||||
|
|
|
@ -581,7 +581,7 @@ async fn source_dist_pkg_info(file: &Path) -> Result<Vec<u8>, PublishPrepareErro
|
|||
let mut pkg_infos: Vec<(PathBuf, Vec<u8>)> = archive
|
||||
.entries()?
|
||||
.map_err(PublishPrepareError::from)
|
||||
.try_filter_map(|mut entry| async move {
|
||||
.try_filter_map(async |mut entry| {
|
||||
let path = entry
|
||||
.path()
|
||||
.map_err(PublishPrepareError::from)?
|
||||
|
|
|
@ -231,11 +231,10 @@ pub(crate) async fn tree(
|
|||
let reporter = LatestVersionReporter::from(printer).with_length(packages.len() as u64);
|
||||
|
||||
// Fetch the latest version for each package.
|
||||
let download_concurrency = &download_concurrency;
|
||||
let mut fetches = futures::stream::iter(packages)
|
||||
.map(|(package, index)| async move {
|
||||
.map(async |(package, index)| {
|
||||
let Some(filename) = client
|
||||
.find_latest(package.name(), Some(&index), download_concurrency)
|
||||
.find_latest(package.name(), Some(&index), &download_concurrency)
|
||||
.await?
|
||||
else {
|
||||
return Ok(None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue