Update Rust toolchain to 1.89 (#15157)

## Summary

Bumps Rust toolchain to 1.89, but not the MSRV.

Lifetime changes is related to a new lint rule explained in
https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint

## Test Plan

Existing Tests
This commit is contained in:
samypr100 2025-08-08 09:01:52 -04:00 committed by GitHub
parent 8f71d239f8
commit 57df0146e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 83 additions and 81 deletions

View File

@ -8,6 +8,7 @@ doc-valid-idents = [
"PyTorch", "PyTorch",
"ROCm", "ROCm",
"XPU", "XPU",
"PowerShell",
".." # Include the defaults ".." # Include the defaults
] ]

View File

@ -564,17 +564,17 @@ pub struct RedirectClientWithMiddleware {
impl RedirectClientWithMiddleware { impl RedirectClientWithMiddleware {
/// Convenience method to make a `GET` request to a URL. /// Convenience method to make a `GET` request to a URL.
pub fn get<U: IntoUrl>(&self, url: U) -> RequestBuilder { pub fn get<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_> {
RequestBuilder::new(self.client.get(url), self) RequestBuilder::new(self.client.get(url), self)
} }
/// Convenience method to make a `POST` request to a URL. /// Convenience method to make a `POST` request to a URL.
pub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder { pub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_> {
RequestBuilder::new(self.client.post(url), self) RequestBuilder::new(self.client.post(url), self)
} }
/// Convenience method to make a `HEAD` request to a URL. /// Convenience method to make a `HEAD` request to a URL.
pub fn head<U: IntoUrl>(&self, url: U) -> RequestBuilder { pub fn head<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_> {
RequestBuilder::new(self.client.head(url), self) RequestBuilder::new(self.client.head(url), self)
} }

View File

@ -297,7 +297,10 @@ impl RegistryClient {
} }
/// Return the appropriate index URLs for the given [`PackageName`]. /// Return the appropriate index URLs for the given [`PackageName`].
fn index_urls_for(&self, package_name: &PackageName) -> impl Iterator<Item = IndexMetadataRef> { fn index_urls_for(
&self,
package_name: &PackageName,
) -> impl Iterator<Item = IndexMetadataRef<'_>> {
self.torch_backend self.torch_backend
.as_ref() .as_ref()
.and_then(|torch_backend| { .and_then(|torch_backend| {

View File

@ -252,7 +252,7 @@ impl DependencyGroupsHistory {
/// Conceptually this being an empty list should be equivalent to /// Conceptually this being an empty list should be equivalent to
/// [`DependencyGroups::is_empty`][] when there aren't any defaults set. /// [`DependencyGroups::is_empty`][] when there aren't any defaults set.
/// When there are defaults the two will disagree, and rightfully so! /// When there are defaults the two will disagree, and rightfully so!
pub fn as_flags_pretty(&self) -> Vec<Cow<str>> { pub fn as_flags_pretty(&self) -> Vec<Cow<'_, str>> {
let Self { let Self {
dev_mode, dev_mode,
group, group,
@ -378,7 +378,7 @@ impl IncludeGroups {
} }
/// Iterate over all groups referenced in the [`IncludeGroups`]. /// Iterate over all groups referenced in the [`IncludeGroups`].
pub fn names(&self) -> std::slice::Iter<GroupName> { pub fn names(&self) -> std::slice::Iter<'_, GroupName> {
match self { match self {
Self::Some(groups) => groups.iter(), Self::Some(groups) => groups.iter(),
Self::All => [].iter(), Self::All => [].iter(),

View File

@ -213,7 +213,7 @@ impl ExtrasSpecificationHistory {
/// Conceptually this being an empty list should be equivalent to /// Conceptually this being an empty list should be equivalent to
/// [`ExtrasSpecification::is_empty`][] when there aren't any defaults set. /// [`ExtrasSpecification::is_empty`][] when there aren't any defaults set.
/// When there are defaults the two will disagree, and rightfully so! /// When there are defaults the two will disagree, and rightfully so!
pub fn as_flags_pretty(&self) -> Vec<Cow<str>> { pub fn as_flags_pretty(&self) -> Vec<Cow<'_, str>> {
let Self { let Self {
extra, extra,
no_extra, no_extra,
@ -312,7 +312,7 @@ impl IncludeExtras {
} }
/// Iterate over all extras referenced in the [`IncludeExtras`]. /// Iterate over all extras referenced in the [`IncludeExtras`].
pub fn names(&self) -> std::slice::Iter<ExtraName> { pub fn names(&self) -> std::slice::Iter<'_, ExtraName> {
match self { match self {
Self::Some(extras) => extras.iter(), Self::Some(extras) => extras.iter(),
Self::All => [].iter(), Self::All => [].iter(),

View File

@ -38,7 +38,7 @@ impl Name for LocalDist {
} }
impl InstalledMetadata for LocalDist { impl InstalledMetadata for LocalDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
match self { match self {
Self::Cached(dist, _) => dist.installed_version(), Self::Cached(dist, _) => dist.installed_version(),
Self::Installed(dist, _) => dist.installed_version(), Self::Installed(dist, _) => dist.installed_version(),

View File

@ -183,19 +183,19 @@ impl Name for CachedDist {
} }
impl DistributionMetadata for CachedRegistryDist { impl DistributionMetadata for CachedRegistryDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Version(&self.filename.version) VersionOrUrlRef::Version(&self.filename.version)
} }
} }
impl DistributionMetadata for CachedDirectUrlDist { impl DistributionMetadata for CachedDirectUrlDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url.verbatim) VersionOrUrlRef::Url(&self.url.verbatim)
} }
} }
impl DistributionMetadata for CachedDist { impl DistributionMetadata for CachedDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Registry(dist) => dist.version_or_url(), Self::Registry(dist) => dist.version_or_url(),
Self::Url(dist) => dist.version_or_url(), Self::Url(dist) => dist.version_or_url(),
@ -204,19 +204,19 @@ impl DistributionMetadata for CachedDist {
} }
impl InstalledMetadata for CachedRegistryDist { impl InstalledMetadata for CachedRegistryDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Version(&self.filename.version) InstalledVersion::Version(&self.filename.version)
} }
} }
impl InstalledMetadata for CachedDirectUrlDist { impl InstalledMetadata for CachedDirectUrlDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Url(&self.url.verbatim, &self.filename.version) InstalledVersion::Url(&self.url.verbatim, &self.filename.version)
} }
} }
impl InstalledMetadata for CachedDist { impl InstalledMetadata for CachedDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
match self { match self {
Self::Registry(dist) => dist.installed_version(), Self::Registry(dist) => dist.installed_version(),
Self::Url(dist) => dist.installed_version(), Self::Url(dist) => dist.installed_version(),

View File

@ -153,7 +153,7 @@ impl DerivationChain {
} }
/// Returns an iterator over the steps in the derivation chain. /// Returns an iterator over the steps in the derivation chain.
pub fn iter(&self) -> std::slice::Iter<DerivationStep> { pub fn iter(&self) -> std::slice::Iter<'_, DerivationStep> {
self.0.iter() self.0.iter()
} }
} }

View File

@ -403,7 +403,7 @@ impl InstalledDist {
} }
impl DistributionMetadata for InstalledDist { impl DistributionMetadata for InstalledDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Version(self.version()) VersionOrUrlRef::Version(self.version())
} }
} }
@ -451,37 +451,37 @@ impl Name for InstalledDist {
} }
impl InstalledMetadata for InstalledRegistryDist { impl InstalledMetadata for InstalledRegistryDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Version(&self.version) InstalledVersion::Version(&self.version)
} }
} }
impl InstalledMetadata for InstalledDirectUrlDist { impl InstalledMetadata for InstalledDirectUrlDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Url(&self.url, &self.version) InstalledVersion::Url(&self.url, &self.version)
} }
} }
impl InstalledMetadata for InstalledEggInfoFile { impl InstalledMetadata for InstalledEggInfoFile {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Version(&self.version) InstalledVersion::Version(&self.version)
} }
} }
impl InstalledMetadata for InstalledEggInfoDirectory { impl InstalledMetadata for InstalledEggInfoDirectory {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Version(&self.version) InstalledVersion::Version(&self.version)
} }
} }
impl InstalledMetadata for InstalledLegacyEditable { impl InstalledMetadata for InstalledLegacyEditable {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
InstalledVersion::Version(&self.version) InstalledVersion::Version(&self.version)
} }
} }
impl InstalledMetadata for InstalledDist { impl InstalledMetadata for InstalledDist {
fn installed_version(&self) -> InstalledVersion { fn installed_version(&self) -> InstalledVersion<'_> {
match self { match self {
Self::Registry(dist) => dist.installed_version(), Self::Registry(dist) => dist.installed_version(),
Self::Url(dist) => dist.installed_version(), Self::Url(dist) => dist.installed_version(),

View File

@ -568,7 +568,7 @@ impl Dist {
} }
/// Convert this distribution into a reference. /// Convert this distribution into a reference.
pub fn as_ref(&self) -> DistRef { pub fn as_ref(&self) -> DistRef<'_> {
match self { match self {
Self::Built(dist) => DistRef::Built(dist), Self::Built(dist) => DistRef::Built(dist),
Self::Source(dist) => DistRef::Source(dist), Self::Source(dist) => DistRef::Source(dist),
@ -874,61 +874,61 @@ impl Name for CompatibleDist<'_> {
} }
impl DistributionMetadata for RegistryBuiltWheel { impl DistributionMetadata for RegistryBuiltWheel {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Version(&self.filename.version) VersionOrUrlRef::Version(&self.filename.version)
} }
} }
impl DistributionMetadata for RegistryBuiltDist { impl DistributionMetadata for RegistryBuiltDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
self.best_wheel().version_or_url() self.best_wheel().version_or_url()
} }
} }
impl DistributionMetadata for DirectUrlBuiltDist { impl DistributionMetadata for DirectUrlBuiltDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for PathBuiltDist { impl DistributionMetadata for PathBuiltDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for RegistrySourceDist { impl DistributionMetadata for RegistrySourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Version(&self.version) VersionOrUrlRef::Version(&self.version)
} }
} }
impl DistributionMetadata for DirectUrlSourceDist { impl DistributionMetadata for DirectUrlSourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for GitSourceDist { impl DistributionMetadata for GitSourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for PathSourceDist { impl DistributionMetadata for PathSourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for DirectorySourceDist { impl DistributionMetadata for DirectorySourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
VersionOrUrlRef::Url(&self.url) VersionOrUrlRef::Url(&self.url)
} }
} }
impl DistributionMetadata for SourceDist { impl DistributionMetadata for SourceDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Registry(dist) => dist.version_or_url(), Self::Registry(dist) => dist.version_or_url(),
Self::DirectUrl(dist) => dist.version_or_url(), Self::DirectUrl(dist) => dist.version_or_url(),
@ -940,7 +940,7 @@ impl DistributionMetadata for SourceDist {
} }
impl DistributionMetadata for BuiltDist { impl DistributionMetadata for BuiltDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Registry(dist) => dist.version_or_url(), Self::Registry(dist) => dist.version_or_url(),
Self::DirectUrl(dist) => dist.version_or_url(), Self::DirectUrl(dist) => dist.version_or_url(),
@ -950,7 +950,7 @@ impl DistributionMetadata for BuiltDist {
} }
impl DistributionMetadata for Dist { impl DistributionMetadata for Dist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Built(dist) => dist.version_or_url(), Self::Built(dist) => dist.version_or_url(),
Self::Source(dist) => dist.version_or_url(), Self::Source(dist) => dist.version_or_url(),

View File

@ -420,7 +420,7 @@ impl PrioritizedDist {
} }
/// Return the highest-priority distribution for the package version, if any. /// Return the highest-priority distribution for the package version, if any.
pub fn get(&self) -> Option<CompatibleDist> { pub fn get(&self) -> Option<CompatibleDist<'_>> {
let best_wheel = self.0.best_wheel_index.map(|i| &self.0.wheels[i]); let best_wheel = self.0.best_wheel_index.map(|i| &self.0.wheels[i]);
match (&best_wheel, &self.0.source) { match (&best_wheel, &self.0.source) {
// If both are compatible, break ties based on the hash outcome. For example, prefer a // If both are compatible, break ties based on the hash outcome. For example, prefer a

View File

@ -37,7 +37,7 @@ impl Name for RequestedDist {
} }
impl DistributionMetadata for RequestedDist { impl DistributionMetadata for RequestedDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Installed(dist) => dist.version_or_url(), Self::Installed(dist) => dist.version_or_url(),
Self::Installable(dist) => dist.version_or_url(), Self::Installable(dist) => dist.version_or_url(),

View File

@ -164,7 +164,7 @@ impl Name for ResolvedDistRef<'_> {
} }
impl DistributionMetadata for ResolvedDistRef<'_> { impl DistributionMetadata for ResolvedDistRef<'_> {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Installed { dist } => VersionOrUrlRef::Version(dist.version()), Self::Installed { dist } => VersionOrUrlRef::Version(dist.version()),
Self::InstallableRegistrySourceDist { sdist, .. } => sdist.version_or_url(), Self::InstallableRegistrySourceDist { sdist, .. } => sdist.version_or_url(),
@ -201,7 +201,7 @@ impl Name for ResolvedDist {
} }
impl DistributionMetadata for ResolvedDist { impl DistributionMetadata for ResolvedDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Installed { dist } => dist.version_or_url(), Self::Installed { dist } => dist.version_or_url(),
Self::Installable { dist, .. } => dist.version_or_url(), Self::Installable { dist, .. } => dist.version_or_url(),

View File

@ -23,7 +23,7 @@ pub trait Name {
pub trait DistributionMetadata: Name { pub trait DistributionMetadata: Name {
/// Return a [`uv_pep440::Version`], for registry-based distributions, or a [`url::Url`], /// Return a [`uv_pep440::Version`], for registry-based distributions, or a [`url::Url`],
/// for URL-based distributions. /// for URL-based distributions.
fn version_or_url(&self) -> VersionOrUrlRef; fn version_or_url(&self) -> VersionOrUrlRef<'_>;
/// Returns a unique identifier for the package at the given version (e.g., `black==23.10.0`). /// Returns a unique identifier for the package at the given version (e.g., `black==23.10.0`).
/// ///
@ -56,7 +56,7 @@ pub trait DistributionMetadata: Name {
/// Metadata that can be resolved from a built distribution. /// Metadata that can be resolved from a built distribution.
pub trait InstalledMetadata: Name { pub trait InstalledMetadata: Name {
/// Return the resolved version of the installed distribution. /// Return the resolved version of the installed distribution.
fn installed_version(&self) -> InstalledVersion; fn installed_version(&self) -> InstalledVersion<'_>;
} }
pub trait RemoteSource { pub trait RemoteSource {

View File

@ -58,12 +58,12 @@ impl<'a> RegistryWheelIndex<'a> {
/// Return an iterator over available wheels for a given package. /// Return an iterator over available wheels for a given package.
/// ///
/// If the package is not yet indexed, this will index the package by reading from the cache. /// If the package is not yet indexed, this will index the package by reading from the cache.
pub fn get(&mut self, name: &'a PackageName) -> impl Iterator<Item = &IndexEntry> { pub fn get(&mut self, name: &'a PackageName) -> impl Iterator<Item = &IndexEntry<'_>> {
self.get_impl(name).iter().rev() self.get_impl(name).iter().rev()
} }
/// Get an entry in the index. /// Get an entry in the index.
fn get_impl(&mut self, name: &'a PackageName) -> &[IndexEntry] { fn get_impl(&mut self, name: &'a PackageName) -> &[IndexEntry<'_>] {
(match self.index.entry(name) { (match self.index.entry(name) {
Entry::Occupied(entry) => entry.into_mut(), Entry::Occupied(entry) => entry.into_mut(),
Entry::Vacant(entry) => entry.insert(Self::index( Entry::Vacant(entry) => entry.insert(Self::index(

View File

@ -207,7 +207,7 @@ pub fn normalize_absolute_path(path: &Path) -> Result<PathBuf, std::io::Error> {
} }
/// Normalize a [`Path`], removing things like `.` and `..`. /// Normalize a [`Path`], removing things like `.` and `..`.
pub fn normalize_path(path: &Path) -> Cow<Path> { pub fn normalize_path(path: &Path) -> Cow<'_, Path> {
// Fast path: if the path is already normalized, return it as-is. // Fast path: if the path is already normalized, return it as-is.
if path.components().all(|component| match component { if path.components().all(|component| match component {
Component::Prefix(_) | Component::RootDir | Component::Normal(_) => true, Component::Prefix(_) | Component::RootDir | Component::Normal(_) => true,

View File

@ -45,7 +45,7 @@ impl GitResolver {
} }
/// Returns the [`GitOid`] for the given [`RepositoryReference`], if it exists. /// Returns the [`GitOid`] for the given [`RepositoryReference`], if it exists.
fn get(&self, reference: &RepositoryReference) -> Option<Ref<RepositoryReference, GitOid>> { fn get(&self, reference: &RepositoryReference) -> Option<Ref<'_, RepositoryReference, GitOid>> {
self.0.get(reference) self.0.get(reference)
} }

View File

@ -360,7 +360,7 @@ impl Version {
/// Returns the release number part of the version. /// Returns the release number part of the version.
#[inline] #[inline]
pub fn release(&self) -> Release { pub fn release(&self) -> Release<'_> {
let inner = match &self.inner { let inner = match &self.inner {
VersionInner::Small { small } => { VersionInner::Small { small } => {
// Parse out the version digits. // Parse out the version digits.
@ -423,7 +423,7 @@ impl Version {
/// Returns the local segments in this version, if any exist. /// Returns the local segments in this version, if any exist.
#[inline] #[inline]
pub fn local(&self) -> LocalVersionSlice { pub fn local(&self) -> LocalVersionSlice<'_> {
match self.inner { match self.inner {
VersionInner::Small { ref small } => small.local_slice(), VersionInner::Small { ref small } => small.local_slice(),
VersionInner::Full { ref full } => full.local.as_slice(), VersionInner::Full { ref full } => full.local.as_slice(),
@ -1405,7 +1405,7 @@ impl VersionSmall {
} }
#[inline] #[inline]
fn local_slice(&self) -> LocalVersionSlice { fn local_slice(&self) -> LocalVersionSlice<'_> {
if self.suffix_kind() == Self::SUFFIX_LOCAL { if self.suffix_kind() == Self::SUFFIX_LOCAL {
LocalVersionSlice::Max LocalVersionSlice::Max
} else { } else {
@ -2725,7 +2725,7 @@ pub(crate) fn compare_release(this: &[u64], other: &[u64]) -> Ordering {
/// implementation /// implementation
/// ///
/// [pep440-suffix-ordering]: https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering /// [pep440-suffix-ordering]: https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering
fn sortable_tuple(version: &Version) -> (u64, u64, Option<u64>, u64, LocalVersionSlice) { fn sortable_tuple(version: &Version) -> (u64, u64, Option<u64>, u64, LocalVersionSlice<'_>) {
// If the version is a "max" version, use a post version larger than any possible post version. // If the version is a "max" version, use a post version larger than any possible post version.
let post = if version.max().is_some() { let post = if version.max().is_some() {
Some(u64::MAX) Some(u64::MAX)

View File

@ -951,7 +951,7 @@ impl<'a> TildeVersionSpecifier<'a> {
} }
/// Construct a new tilde `VersionSpecifier` with the given patch version appended. /// Construct a new tilde `VersionSpecifier` with the given patch version appended.
pub fn with_patch_version(&self, patch: u64) -> TildeVersionSpecifier { pub fn with_patch_version(&self, patch: u64) -> TildeVersionSpecifier<'_> {
let mut release = self.inner.version.release().to_vec(); let mut release = self.inner.version.release().to_vec();
if self.has_patch() { if self.has_patch() {
release.pop(); release.pop();

View File

@ -3693,20 +3693,20 @@ mod test {
let b = ExtraName::from_str("b").unwrap(); let b = ExtraName::from_str("b").unwrap();
let marker = m("extra == 'a' and extra == 'b'"); let marker = m("extra == 'a' and extra == 'b'");
assert!(!marker.evaluate_only_extras(&[a.clone()])); assert!(!marker.evaluate_only_extras(std::slice::from_ref(&a)));
assert!(!marker.evaluate_only_extras(&[b.clone()])); assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b)));
assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()]));
let marker = m("(platform_machine == 'inapplicable' and extra == 'b') or extra == 'a'"); let marker = m("(platform_machine == 'inapplicable' and extra == 'b') or extra == 'a'");
assert!(marker.evaluate_only_extras(&[a.clone()])); assert!(marker.evaluate_only_extras(std::slice::from_ref(&a)));
assert!(!marker.evaluate_only_extras(&[b.clone()])); assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b)));
assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()]));
let marker = m( let marker = m(
"(platform_machine == 'inapplicable' and extra == 'a') or (platform_machine != 'inapplicable' and extra == 'b')", "(platform_machine == 'inapplicable' and extra == 'a') or (platform_machine != 'inapplicable' and extra == 'b')",
); );
assert!(!marker.evaluate_only_extras(&[a.clone()])); assert!(!marker.evaluate_only_extras(std::slice::from_ref(&a)));
assert!(!marker.evaluate_only_extras(&[b.clone()])); assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b)));
assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()]));
} }
} }

View File

@ -524,7 +524,7 @@ pub fn looks_like_git_repository(url: &Url) -> bool {
/// ///
/// For example, given `file:///home/ferris/project/scripts#hash=somehash`, returns /// For example, given `file:///home/ferris/project/scripts#hash=somehash`, returns
/// `("/home/ferris/project/scripts", Some("hash=somehash"))`. /// `("/home/ferris/project/scripts", Some("hash=somehash"))`.
fn split_fragment(path: &Path) -> (Cow<Path>, Option<&str>) { fn split_fragment(path: &Path) -> (Cow<'_, Path>, Option<&str>) {
let Some(s) = path.to_str() else { let Some(s) = path.to_str() else {
return (Cow::Borrowed(path), None); return (Cow::Borrowed(path), None);
}; };

View File

@ -25,7 +25,7 @@ impl SupportedEnvironments {
} }
/// Returns an iterator over the marker trees. /// Returns an iterator over the marker trees.
pub fn iter(&self) -> std::slice::Iter<MarkerTree> { pub fn iter(&self) -> std::slice::Iter<'_, MarkerTree> {
self.0.iter() self.0.iter()
} }
} }

View File

@ -302,7 +302,7 @@ impl PythonEnvironment {
/// ///
/// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we
/// still deduplicate the entries, returning a single path. /// still deduplicate the entries, returning a single path.
pub fn site_packages(&self) -> impl Iterator<Item = Cow<Path>> { pub fn site_packages(&self) -> impl Iterator<Item = Cow<'_, Path>> {
self.0.interpreter.site_packages() self.0.interpreter.site_packages()
} }

View File

@ -567,7 +567,7 @@ impl Interpreter {
/// ///
/// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we
/// still deduplicate the entries, returning a single path. /// still deduplicate the entries, returning a single path.
pub fn site_packages(&self) -> impl Iterator<Item = Cow<Path>> { pub fn site_packages(&self) -> impl Iterator<Item = Cow<'_, Path>> {
let target = self.target().map(Target::site_packages); let target = self.target().map(Target::site_packages);
let prefix = self let prefix = self

View File

@ -22,7 +22,7 @@ pub(super) struct SysconfigData(BTreeMap<String, Value>);
impl SysconfigData { impl SysconfigData {
/// Returns an iterator over the key-value pairs in the map. /// Returns an iterator over the key-value pairs in the map.
pub(super) fn iter_mut(&mut self) -> std::collections::btree_map::IterMut<String, Value> { pub(super) fn iter_mut(&mut self) -> std::collections::btree_map::IterMut<'_, String, Value> {
self.0.iter_mut() self.0.iter_mut()
} }

View File

@ -740,7 +740,7 @@ impl Name for Candidate<'_> {
} }
impl DistributionMetadata for Candidate<'_> { impl DistributionMetadata for Candidate<'_> {
fn version_or_url(&self) -> uv_distribution_types::VersionOrUrlRef { fn version_or_url(&self) -> uv_distribution_types::VersionOrUrlRef<'_> {
uv_distribution_types::VersionOrUrlRef::Version(self.version) uv_distribution_types::VersionOrUrlRef::Version(self.version)
} }
} }

View File

@ -1306,7 +1306,7 @@ impl PylockTomlPackage {
impl PylockTomlWheel { impl PylockTomlWheel {
/// Return the [`WheelFilename`] for this wheel. /// Return the [`WheelFilename`] for this wheel.
fn filename(&self, name: &PackageName) -> Result<Cow<WheelFilename>, PylockTomlErrorKind> { fn filename(&self, name: &PackageName) -> Result<Cow<'_, WheelFilename>, PylockTomlErrorKind> {
if let Some(name) = self.name.as_ref() { if let Some(name) = self.name.as_ref() {
Ok(Cow::Borrowed(name)) Ok(Cow::Borrowed(name))
} else if let Some(path) = self.path.as_ref() { } else if let Some(path) = self.path.as_ref() {

View File

@ -3934,7 +3934,7 @@ enum SourceDist {
} }
impl SourceDist { impl SourceDist {
fn filename(&self) -> Option<Cow<str>> { fn filename(&self) -> Option<Cow<'_, str>> {
match self { match self {
Self::Metadata { .. } => None, Self::Metadata { .. } => None,
Self::Url { url, .. } => url.filename().ok(), Self::Url { url, .. } => url.filename().ok(),

View File

@ -29,7 +29,7 @@ impl Name for PubGrubDistribution<'_> {
} }
impl DistributionMetadata for PubGrubDistribution<'_> { impl DistributionMetadata for PubGrubDistribution<'_> {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
match self { match self {
Self::Registry(_, version) => VersionOrUrlRef::Version(version), Self::Registry(_, version) => VersionOrUrlRef::Version(version),
Self::Url(_, url) => VersionOrUrlRef::Url(&url.verbatim), Self::Url(_, url) => VersionOrUrlRef::Url(&url.verbatim),

View File

@ -75,7 +75,7 @@ impl Name for AnnotatedDist {
} }
impl DistributionMetadata for AnnotatedDist { impl DistributionMetadata for AnnotatedDist {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
self.dist.version_or_url() self.dist.version_or_url()
} }
} }

View File

@ -36,7 +36,7 @@ impl<'dist> RequirementsTxtDist<'dist> {
&self, &self,
requires_python: &RequiresPython, requires_python: &RequiresPython,
include_markers: bool, include_markers: bool,
) -> Cow<str> { ) -> Cow<'_, str> {
// If the URL is editable, write it as an editable requirement. // If the URL is editable, write it as an editable requirement.
if self.dist.is_editable() { if self.dist.is_editable() {
if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() { if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() {
@ -143,7 +143,7 @@ impl<'dist> RequirementsTxtDist<'dist> {
/// Convert the [`RequirementsTxtDist`] to a comparator that can be used to sort the requirements /// Convert the [`RequirementsTxtDist`] to a comparator that can be used to sort the requirements
/// in a `requirements.txt` file. /// in a `requirements.txt` file.
pub(crate) fn to_comparator(&self) -> RequirementsTxtComparator { pub(crate) fn to_comparator(&self) -> RequirementsTxtComparator<'_> {
if self.dist.is_editable() { if self.dist.is_editable() {
if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() { if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() {
return RequirementsTxtComparator::Url(url.verbatim()); return RequirementsTxtComparator::Url(url.verbatim());
@ -213,7 +213,7 @@ impl Name for RequirementsTxtDist<'_> {
} }
impl DistributionMetadata for RequirementsTxtDist<'_> { impl DistributionMetadata for RequirementsTxtDist<'_> {
fn version_or_url(&self) -> VersionOrUrlRef { fn version_or_url(&self) -> VersionOrUrlRef<'_> {
self.dist.version_or_url() self.dist.version_or_url()
} }
} }

View File

@ -174,7 +174,7 @@ impl VersionMap {
pub(crate) fn iter( pub(crate) fn iter(
&self, &self,
range: &Ranges<Version>, range: &Ranges<Version>,
) -> impl DoubleEndedIterator<Item = (&Version, VersionMapDistHandle)> { ) -> impl DoubleEndedIterator<Item = (&Version, VersionMapDistHandle<'_>)> {
// Performance optimization: If we only have a single version, return that version directly. // Performance optimization: If we only have a single version, return that version directly.
if let Some(version) = range.as_singleton() { if let Some(version) = range.as_singleton() {
either::Either::Left(match self.inner { either::Either::Left(match self.inner {

View File

@ -32,7 +32,7 @@ pub enum HashStrategy {
impl HashStrategy { impl HashStrategy {
/// Return the [`HashPolicy`] for the given distribution. /// Return the [`HashPolicy`] for the given distribution.
pub fn get<T: DistributionMetadata>(&self, distribution: &T) -> HashPolicy { pub fn get<T: DistributionMetadata>(&self, distribution: &T) -> HashPolicy<'_> {
match self { match self {
Self::None => HashPolicy::None, Self::None => HashPolicy::None,
Self::Generate(mode) => HashPolicy::Generate(*mode), Self::Generate(mode) => HashPolicy::Generate(*mode),
@ -53,7 +53,7 @@ impl HashStrategy {
} }
/// Return the [`HashPolicy`] for the given registry-based package. /// Return the [`HashPolicy`] for the given registry-based package.
pub fn get_package(&self, name: &PackageName, version: &Version) -> HashPolicy { pub fn get_package(&self, name: &PackageName, version: &Version) -> HashPolicy<'_> {
match self { match self {
Self::None => HashPolicy::None, Self::None => HashPolicy::None,
Self::Generate(mode) => HashPolicy::Generate(*mode), Self::Generate(mode) => HashPolicy::Generate(*mode),
@ -76,7 +76,7 @@ impl HashStrategy {
} }
/// Return the [`HashPolicy`] for the given direct URL package. /// Return the [`HashPolicy`] for the given direct URL package.
pub fn get_url(&self, url: &DisplaySafeUrl) -> HashPolicy { pub fn get_url(&self, url: &DisplaySafeUrl) -> HashPolicy<'_> {
match self { match self {
Self::None => HashPolicy::None, Self::None => HashPolicy::None,
Self::Generate(mode) => HashPolicy::Generate(*mode), Self::Generate(mode) => HashPolicy::Generate(*mode),

View File

@ -225,7 +225,7 @@ impl FlatDependencyGroups {
} }
/// Return the entry for a given group, if any. /// Return the entry for a given group, if any.
pub fn entry(&mut self, group: GroupName) -> Entry<GroupName, FlatDependencyGroup> { pub fn entry(&mut self, group: GroupName) -> Entry<'_, GroupName, FlatDependencyGroup> {
self.0.entry(group) self.0.entry(group)
} }

View File

@ -546,8 +546,8 @@ impl Deref for SyncEnvironment {
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
match self { match self {
Self::Project(environment) => Deref::deref(environment), Self::Project(environment) => environment,
Self::Script(environment) => Deref::deref(environment), Self::Script(environment) => environment,
} }
} }
} }

View File

@ -25,9 +25,7 @@ pub(crate) async fn self_update(
printer.stderr(), printer.stderr(),
"{}", "{}",
format_args!( format_args!(
concat!( "{}{} Self-update is not possible because network connectivity is disabled (i.e., with `--offline`)",
"{}{} Self-update is not possible because network connectivity is disabled (i.e., with `--offline`)"
),
"error".red().bold(), "error".red().bold(),
":".bold() ":".bold()
) )

View File

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.88" channel = "1.89"