Rust 1.75 (#736)

The `async fn` and return-position `impl Trait` in traits improve
`BuildContext` ergonomics. The traits use `impl Future` over `async fn`
to make the send bound explicit
(https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-traits.html).

The remaining changes are due to clippy.
This commit is contained in:
konsti 2023-12-28 21:08:35 +01:00 committed by GitHub
parent 7bf2790a25
commit 2d4cb1ebf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 46 deletions

View file

@ -1,7 +1,6 @@
//! Given a set of requirements, find a set of compatible packages.
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use anyhow::Result;
@ -52,7 +51,7 @@ pub trait ResolverProvider: Send + Sync {
fn get_version_map<'io>(
&'io self,
package_name: &'io PackageName,
) -> Pin<Box<dyn Future<Output = VersionMapResponse> + Send + 'io>>;
) -> impl Future<Output = VersionMapResponse> + Send + 'io;
/// Get the metadata for a distribution.
///
@ -62,7 +61,7 @@ pub trait ResolverProvider: Send + Sync {
fn get_or_build_wheel_metadata<'io>(
&'io self,
dist: &'io Dist,
) -> Pin<Box<dyn Future<Output = WheelMetadataResponse> + Send + 'io>>;
) -> impl Future<Output = WheelMetadataResponse> + Send + 'io;
/// Set the [`Reporter`] to use for this installer.
#[must_use]
@ -109,7 +108,7 @@ impl<'a, Context: BuildContext + Send + Sync> ResolverProvider
fn get_version_map<'io>(
&'io self,
package_name: &'io PackageName,
) -> Pin<Box<dyn Future<Output = VersionMapResponse> + Send + 'io>> {
) -> impl Future<Output = VersionMapResponse> + Send + 'io {
Box::pin(
self.client
.simple(package_name)
@ -134,7 +133,7 @@ impl<'a, Context: BuildContext + Send + Sync> ResolverProvider
fn get_or_build_wheel_metadata<'io>(
&'io self,
dist: &'io Dist,
) -> Pin<Box<dyn Future<Output = WheelMetadataResponse> + Send + 'io>> {
) -> impl Future<Output = WheelMetadataResponse> + Send + 'io {
Box::pin(self.fetcher.get_or_build_wheel_metadata(dist))
}