Bump MSRV to 1.85 and Edition 2024 (#13516)

## Summary

Builds on https://github.com/astral-sh/uv/pull/11724.

Closes https://github.com/astral-sh/uv/issues/13476.
This commit is contained in:
Charlie Marsh 2025-05-18 19:38:43 -04:00 committed by GitHub
parent cc6e766232
commit c5032aee80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
240 changed files with 726 additions and 737 deletions

View file

@ -25,10 +25,10 @@ use uv_static::EnvVars;
use uv_version::version;
use uv_warnings::warn_user_once;
use crate::Connectivity;
use crate::linehaul::LineHaul;
use crate::middleware::OfflineMiddleware;
use crate::tls::read_identity;
use crate::Connectivity;
pub const DEFAULT_RETRIES: u32 = 3;

View file

@ -8,17 +8,17 @@ use reqwest_retry::RetryPolicy;
use rkyv::util::AlignedVec;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use tracing::{debug, info_span, instrument, trace, warn, Instrument};
use tracing::{Instrument, debug, info_span, instrument, trace, warn};
use uv_cache::{CacheEntry, Freshness};
use uv_fs::write_atomic;
use crate::base_client::is_extended_transient_error;
use crate::BaseClient;
use crate::base_client::is_extended_transient_error;
use crate::{
Error, ErrorKind,
httpcache::{AfterResponse, BeforeRequest, CachePolicy, CachePolicyBuilder},
rkyvutil::OwnedArchive,
Error, ErrorKind,
};
/// A trait the generalizes (de)serialization at a high level.
@ -230,7 +230,7 @@ impl CachedClient {
CallbackReturn: Future<Output = Result<Payload, CallBackError>>,
{
let payload = self
.get_cacheable(req, cache_entry, cache_control, |resp| async {
.get_cacheable(req, cache_entry, cache_control, async |resp| {
let payload = response_callback(resp).await?;
Ok(SerdeCacheable { inner: payload })
})
@ -359,7 +359,7 @@ impl CachedClient {
let (response, cache_policy) = self.fresh_request(req).await?;
let payload = self
.run_response_callback(cache_entry, cache_policy, response, move |resp| async {
.run_response_callback(cache_entry, cache_policy, response, async |resp| {
let payload = response_callback(resp).await?;
Ok(SerdeCacheable { inner: payload })
})
@ -585,7 +585,7 @@ impl CachedClient {
CallbackReturn: Future<Output = Result<Payload, CallBackError>>,
{
let payload = self
.get_cacheable_with_retry(req, cache_entry, cache_control, |resp| async {
.get_cacheable_with_retry(req, cache_entry, cache_control, async |resp| {
let payload = response_callback(resp).await?;
Ok(SerdeCacheable { inner: payload })
})

View file

@ -10,7 +10,7 @@ use uv_normalize::PackageName;
use uv_redacted::redacted_url;
use crate::middleware::OfflineError;
use crate::{html, FlatIndexError};
use crate::{FlatIndexError, html};
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
@ -46,7 +46,7 @@ impl Error {
/// Returns `true` if this error corresponds to an I/O "not found" error.
pub(crate) fn is_file_not_exists(&self) -> bool {
let ErrorKind::Io(ref err) = &*self.kind else {
let ErrorKind::Io(err) = &*self.kind else {
return false;
};
matches!(err.kind(), std::io::ErrorKind::NotFound)
@ -246,7 +246,9 @@ pub enum ErrorKind {
#[error("Writing to cache archive failed: {0}")]
ArchiveWrite(String),
#[error("Network connectivity is disabled, but the requested data wasn't found in the cache for: `{0}`")]
#[error(
"Network connectivity is disabled, but the requested data wasn't found in the cache for: `{0}`"
)]
Offline(String),
}

View file

@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
use futures::{FutureExt, StreamExt};
use reqwest::Response;
use tracing::{debug, info_span, warn, Instrument};
use tracing::{Instrument, debug, info_span, warn};
use url::Url;
use uv_cache::{Cache, CacheBucket};
@ -113,7 +113,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 = self.fetch_index(index).await?;
if entries.is_empty() {
warn!("No packages found in `--find-links` entry: {}", index);

View file

@ -1,6 +1,6 @@
pub use base_client::{
is_extended_transient_error, AuthIntegration, BaseClient, BaseClientBuilder, ExtraMiddleware,
UvRetryableStrategy, DEFAULT_RETRIES,
AuthIntegration, BaseClient, BaseClientBuilder, DEFAULT_RETRIES, ExtraMiddleware,
UvRetryableStrategy, is_extended_transient_error,
};
pub use cached_client::{CacheControl, CachedClient, CachedClientError, DataWithCachePolicy};
pub use error::{Error, ErrorKind, WrappedReqwestError};

View file

@ -20,7 +20,11 @@ impl OfflineError {
impl std::fmt::Display for OfflineError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Network connectivity is disabled, but the requested data wasn't found in the cache for: `{}`", self.url)
write!(
f,
"Network connectivity is disabled, but the requested data wasn't found in the cache for: `{}`",
self.url
)
}
}

View file

@ -13,7 +13,7 @@ use reqwest::{Proxy, Response};
use reqwest_middleware::ClientWithMiddleware;
use rustc_hash::FxHashMap;
use tokio::sync::{Mutex, Semaphore};
use tracing::{debug, info_span, instrument, trace, warn, Instrument};
use tracing::{Instrument, debug, info_span, instrument, trace, warn};
use url::Url;
use uv_auth::Indexes;
@ -352,7 +352,9 @@ impl RegistryClient {
// The search failed because of an HTTP status code that we don't ignore for
// this index. We end our search here.
SimpleMetadataSearchOutcome::StatusCodeFailure(status_code) => {
debug!("Indexes search failed because of status code failure: {status_code}");
debug!(
"Indexes search failed because of status code failure: {status_code}"
);
break;
}
}
@ -371,7 +373,7 @@ impl RegistryClient {
// Otherwise, fetch concurrently.
IndexStrategy::UnsafeBestMatch | IndexStrategy::UnsafeFirstMatch => {
results = futures::stream::iter(indexes)
.map(|index| async move {
.map(async |index| {
let _permit = download_concurrency.acquire().await;
match index.format {
IndexFormat::Simple => {
@ -400,12 +402,10 @@ impl RegistryClient {
}
})
.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?;
@ -800,7 +800,7 @@ impl RegistryClient {
lock_entry.lock().await.map_err(ErrorKind::CacheWrite)?
};
let response_callback = |response: Response| async {
let response_callback = async |response: Response| {
let bytes = response
.bytes()
.await
@ -987,11 +987,12 @@ impl RegistryClient {
std::io::Error::new(
std::io::ErrorKind::TimedOut,
format!(
"Failed to download distribution due to network timeout. Try increasing UV_HTTP_TIMEOUT (current value: {}s).", self.timeout().as_secs()
"Failed to download distribution due to network timeout. Try increasing UV_HTTP_TIMEOUT (current value: {}s).",
self.timeout().as_secs()
),
)
} else {
std::io::Error::new(std::io::ErrorKind::Other, err)
std::io::Error::other(err)
}
}
}
@ -1224,7 +1225,7 @@ mod tests {
use uv_normalize::PackageName;
use uv_pypi_types::{JoinRelativeError, SimpleJson};
use crate::{html::SimpleHtml, SimpleMetadata, SimpleMetadatum};
use crate::{SimpleMetadata, SimpleMetadatum, html::SimpleHtml};
#[test]
fn ignore_failing_files() {

View file

@ -12,12 +12,12 @@ serializing and deserializing.
*/
use rkyv::{
Archive, Deserialize, Portable, Serialize,
api::high::{HighDeserializer, HighSerializer, HighValidator},
bytecheck::CheckBytes,
rancor,
ser::allocator::ArenaHandle,
util::AlignedVec,
Archive, Deserialize, Portable, Serialize,
};
use crate::{Error, ErrorKind};