diff --git a/clippy.toml b/clippy.toml index 1151d773d..949a93200 100644 --- a/clippy.toml +++ b/clippy.toml @@ -8,6 +8,7 @@ doc-valid-idents = [ "PyTorch", "ROCm", "XPU", + "PowerShell", ".." # Include the defaults ] diff --git a/crates/uv-client/src/base_client.rs b/crates/uv-client/src/base_client.rs index d658406bf..81c78e145 100644 --- a/crates/uv-client/src/base_client.rs +++ b/crates/uv-client/src/base_client.rs @@ -564,17 +564,17 @@ pub struct RedirectClientWithMiddleware { impl RedirectClientWithMiddleware { /// Convenience method to make a `GET` request to a URL. - pub fn get(&self, url: U) -> RequestBuilder { + pub fn get(&self, url: U) -> RequestBuilder<'_> { RequestBuilder::new(self.client.get(url), self) } /// Convenience method to make a `POST` request to a URL. - pub fn post(&self, url: U) -> RequestBuilder { + pub fn post(&self, url: U) -> RequestBuilder<'_> { RequestBuilder::new(self.client.post(url), self) } /// Convenience method to make a `HEAD` request to a URL. - pub fn head(&self, url: U) -> RequestBuilder { + pub fn head(&self, url: U) -> RequestBuilder<'_> { RequestBuilder::new(self.client.head(url), self) } diff --git a/crates/uv-client/src/registry_client.rs b/crates/uv-client/src/registry_client.rs index 3a7b049a3..a1a7b22fa 100644 --- a/crates/uv-client/src/registry_client.rs +++ b/crates/uv-client/src/registry_client.rs @@ -297,7 +297,10 @@ impl RegistryClient { } /// Return the appropriate index URLs for the given [`PackageName`]. - fn index_urls_for(&self, package_name: &PackageName) -> impl Iterator { + fn index_urls_for( + &self, + package_name: &PackageName, + ) -> impl Iterator> { self.torch_backend .as_ref() .and_then(|torch_backend| { diff --git a/crates/uv-configuration/src/dependency_groups.rs b/crates/uv-configuration/src/dependency_groups.rs index 474406ba5..40205323a 100644 --- a/crates/uv-configuration/src/dependency_groups.rs +++ b/crates/uv-configuration/src/dependency_groups.rs @@ -252,7 +252,7 @@ impl DependencyGroupsHistory { /// Conceptually this being an empty list should be equivalent to /// [`DependencyGroups::is_empty`][] when there aren't any defaults set. /// When there are defaults the two will disagree, and rightfully so! - pub fn as_flags_pretty(&self) -> Vec> { + pub fn as_flags_pretty(&self) -> Vec> { let Self { dev_mode, group, @@ -378,7 +378,7 @@ impl IncludeGroups { } /// Iterate over all groups referenced in the [`IncludeGroups`]. - pub fn names(&self) -> std::slice::Iter { + pub fn names(&self) -> std::slice::Iter<'_, GroupName> { match self { Self::Some(groups) => groups.iter(), Self::All => [].iter(), diff --git a/crates/uv-configuration/src/extras.rs b/crates/uv-configuration/src/extras.rs index 40fc72d28..511f1daa9 100644 --- a/crates/uv-configuration/src/extras.rs +++ b/crates/uv-configuration/src/extras.rs @@ -213,7 +213,7 @@ impl ExtrasSpecificationHistory { /// Conceptually this being an empty list should be equivalent to /// [`ExtrasSpecification::is_empty`][] when there aren't any defaults set. /// When there are defaults the two will disagree, and rightfully so! - pub fn as_flags_pretty(&self) -> Vec> { + pub fn as_flags_pretty(&self) -> Vec> { let Self { extra, no_extra, @@ -312,7 +312,7 @@ impl IncludeExtras { } /// Iterate over all extras referenced in the [`IncludeExtras`]. - pub fn names(&self) -> std::slice::Iter { + pub fn names(&self) -> std::slice::Iter<'_, ExtraName> { match self { Self::Some(extras) => extras.iter(), Self::All => [].iter(), diff --git a/crates/uv-distribution-types/src/any.rs b/crates/uv-distribution-types/src/any.rs index 6a29a0ff8..a545d1500 100644 --- a/crates/uv-distribution-types/src/any.rs +++ b/crates/uv-distribution-types/src/any.rs @@ -38,7 +38,7 @@ impl Name for LocalDist { } impl InstalledMetadata for LocalDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { match self { Self::Cached(dist, _) => dist.installed_version(), Self::Installed(dist, _) => dist.installed_version(), diff --git a/crates/uv-distribution-types/src/cached.rs b/crates/uv-distribution-types/src/cached.rs index 84118ec49..e62b8ac30 100644 --- a/crates/uv-distribution-types/src/cached.rs +++ b/crates/uv-distribution-types/src/cached.rs @@ -183,19 +183,19 @@ impl Name for CachedDist { } impl DistributionMetadata for CachedRegistryDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Version(&self.filename.version) } } impl DistributionMetadata for CachedDirectUrlDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url.verbatim) } } impl DistributionMetadata for CachedDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Registry(dist) => dist.version_or_url(), Self::Url(dist) => dist.version_or_url(), @@ -204,19 +204,19 @@ impl DistributionMetadata for CachedDist { } impl InstalledMetadata for CachedRegistryDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Version(&self.filename.version) } } impl InstalledMetadata for CachedDirectUrlDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Url(&self.url.verbatim, &self.filename.version) } } impl InstalledMetadata for CachedDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { match self { Self::Registry(dist) => dist.installed_version(), Self::Url(dist) => dist.installed_version(), diff --git a/crates/uv-distribution-types/src/dist_error.rs b/crates/uv-distribution-types/src/dist_error.rs index 8708081aa..4f9335bc4 100644 --- a/crates/uv-distribution-types/src/dist_error.rs +++ b/crates/uv-distribution-types/src/dist_error.rs @@ -153,7 +153,7 @@ impl DerivationChain { } /// Returns an iterator over the steps in the derivation chain. - pub fn iter(&self) -> std::slice::Iter { + pub fn iter(&self) -> std::slice::Iter<'_, DerivationStep> { self.0.iter() } } diff --git a/crates/uv-distribution-types/src/installed.rs b/crates/uv-distribution-types/src/installed.rs index a285fc1db..c95884bf6 100644 --- a/crates/uv-distribution-types/src/installed.rs +++ b/crates/uv-distribution-types/src/installed.rs @@ -403,7 +403,7 @@ impl InstalledDist { } impl DistributionMetadata for InstalledDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Version(self.version()) } } @@ -451,37 +451,37 @@ impl Name for InstalledDist { } impl InstalledMetadata for InstalledRegistryDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Version(&self.version) } } impl InstalledMetadata for InstalledDirectUrlDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Url(&self.url, &self.version) } } impl InstalledMetadata for InstalledEggInfoFile { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Version(&self.version) } } impl InstalledMetadata for InstalledEggInfoDirectory { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Version(&self.version) } } impl InstalledMetadata for InstalledLegacyEditable { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { InstalledVersion::Version(&self.version) } } impl InstalledMetadata for InstalledDist { - fn installed_version(&self) -> InstalledVersion { + fn installed_version(&self) -> InstalledVersion<'_> { match self { Self::Registry(dist) => dist.installed_version(), Self::Url(dist) => dist.installed_version(), diff --git a/crates/uv-distribution-types/src/lib.rs b/crates/uv-distribution-types/src/lib.rs index c6dd1b21c..74021914b 100644 --- a/crates/uv-distribution-types/src/lib.rs +++ b/crates/uv-distribution-types/src/lib.rs @@ -568,7 +568,7 @@ impl Dist { } /// Convert this distribution into a reference. - pub fn as_ref(&self) -> DistRef { + pub fn as_ref(&self) -> DistRef<'_> { match self { Self::Built(dist) => DistRef::Built(dist), Self::Source(dist) => DistRef::Source(dist), @@ -874,61 +874,61 @@ impl Name for CompatibleDist<'_> { } impl DistributionMetadata for RegistryBuiltWheel { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Version(&self.filename.version) } } impl DistributionMetadata for RegistryBuiltDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { self.best_wheel().version_or_url() } } impl DistributionMetadata for DirectUrlBuiltDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for PathBuiltDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for RegistrySourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Version(&self.version) } } impl DistributionMetadata for DirectUrlSourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for GitSourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for PathSourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for DirectorySourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { VersionOrUrlRef::Url(&self.url) } } impl DistributionMetadata for SourceDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Registry(dist) => dist.version_or_url(), Self::DirectUrl(dist) => dist.version_or_url(), @@ -940,7 +940,7 @@ impl DistributionMetadata for SourceDist { } impl DistributionMetadata for BuiltDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Registry(dist) => dist.version_or_url(), Self::DirectUrl(dist) => dist.version_or_url(), @@ -950,7 +950,7 @@ impl DistributionMetadata for BuiltDist { } impl DistributionMetadata for Dist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Built(dist) => dist.version_or_url(), Self::Source(dist) => dist.version_or_url(), diff --git a/crates/uv-distribution-types/src/prioritized_distribution.rs b/crates/uv-distribution-types/src/prioritized_distribution.rs index f2c4e267d..0d88246ac 100644 --- a/crates/uv-distribution-types/src/prioritized_distribution.rs +++ b/crates/uv-distribution-types/src/prioritized_distribution.rs @@ -420,7 +420,7 @@ impl PrioritizedDist { } /// Return the highest-priority distribution for the package version, if any. - pub fn get(&self) -> Option { + pub fn get(&self) -> Option> { let best_wheel = self.0.best_wheel_index.map(|i| &self.0.wheels[i]); match (&best_wheel, &self.0.source) { // If both are compatible, break ties based on the hash outcome. For example, prefer a diff --git a/crates/uv-distribution-types/src/requested.rs b/crates/uv-distribution-types/src/requested.rs index b804a16ad..de3b4936d 100644 --- a/crates/uv-distribution-types/src/requested.rs +++ b/crates/uv-distribution-types/src/requested.rs @@ -37,7 +37,7 @@ impl Name for RequestedDist { } impl DistributionMetadata for RequestedDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Installed(dist) => dist.version_or_url(), Self::Installable(dist) => dist.version_or_url(), diff --git a/crates/uv-distribution-types/src/resolved.rs b/crates/uv-distribution-types/src/resolved.rs index 9567f6936..3c758b254 100644 --- a/crates/uv-distribution-types/src/resolved.rs +++ b/crates/uv-distribution-types/src/resolved.rs @@ -164,7 +164,7 @@ impl Name for ResolvedDistRef<'_> { } impl DistributionMetadata for ResolvedDistRef<'_> { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Installed { dist } => VersionOrUrlRef::Version(dist.version()), Self::InstallableRegistrySourceDist { sdist, .. } => sdist.version_or_url(), @@ -201,7 +201,7 @@ impl Name for ResolvedDist { } impl DistributionMetadata for ResolvedDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Installed { dist } => dist.version_or_url(), Self::Installable { dist, .. } => dist.version_or_url(), diff --git a/crates/uv-distribution-types/src/traits.rs b/crates/uv-distribution-types/src/traits.rs index 0ddf735e8..af2bde5af 100644 --- a/crates/uv-distribution-types/src/traits.rs +++ b/crates/uv-distribution-types/src/traits.rs @@ -23,7 +23,7 @@ pub trait Name { pub trait DistributionMetadata: Name { /// Return a [`uv_pep440::Version`], for registry-based distributions, or a [`url::Url`], /// 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`). /// @@ -56,7 +56,7 @@ pub trait DistributionMetadata: Name { /// Metadata that can be resolved from a built distribution. pub trait InstalledMetadata: Name { /// Return the resolved version of the installed distribution. - fn installed_version(&self) -> InstalledVersion; + fn installed_version(&self) -> InstalledVersion<'_>; } pub trait RemoteSource { diff --git a/crates/uv-distribution/src/index/registry_wheel_index.rs b/crates/uv-distribution/src/index/registry_wheel_index.rs index 09f1bd5c7..8368fb4f9 100644 --- a/crates/uv-distribution/src/index/registry_wheel_index.rs +++ b/crates/uv-distribution/src/index/registry_wheel_index.rs @@ -58,12 +58,12 @@ impl<'a> RegistryWheelIndex<'a> { /// 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. - pub fn get(&mut self, name: &'a PackageName) -> impl Iterator { + pub fn get(&mut self, name: &'a PackageName) -> impl Iterator> { self.get_impl(name).iter().rev() } /// 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) { Entry::Occupied(entry) => entry.into_mut(), Entry::Vacant(entry) => entry.insert(Self::index( diff --git a/crates/uv-fs/src/path.rs b/crates/uv-fs/src/path.rs index 45d1da1c8..4147a0cb3 100644 --- a/crates/uv-fs/src/path.rs +++ b/crates/uv-fs/src/path.rs @@ -207,7 +207,7 @@ pub fn normalize_absolute_path(path: &Path) -> Result { } /// Normalize a [`Path`], removing things like `.` and `..`. -pub fn normalize_path(path: &Path) -> Cow { +pub fn normalize_path(path: &Path) -> Cow<'_, Path> { // Fast path: if the path is already normalized, return it as-is. if path.components().all(|component| match component { Component::Prefix(_) | Component::RootDir | Component::Normal(_) => true, diff --git a/crates/uv-git/src/resolver.rs b/crates/uv-git/src/resolver.rs index 3c12fc589..e6e6e5ccd 100644 --- a/crates/uv-git/src/resolver.rs +++ b/crates/uv-git/src/resolver.rs @@ -45,7 +45,7 @@ impl GitResolver { } /// Returns the [`GitOid`] for the given [`RepositoryReference`], if it exists. - fn get(&self, reference: &RepositoryReference) -> Option> { + fn get(&self, reference: &RepositoryReference) -> Option> { self.0.get(reference) } diff --git a/crates/uv-pep440/src/version.rs b/crates/uv-pep440/src/version.rs index 8b42acdd6..169eb795a 100644 --- a/crates/uv-pep440/src/version.rs +++ b/crates/uv-pep440/src/version.rs @@ -360,7 +360,7 @@ impl Version { /// Returns the release number part of the version. #[inline] - pub fn release(&self) -> Release { + pub fn release(&self) -> Release<'_> { let inner = match &self.inner { VersionInner::Small { small } => { // Parse out the version digits. @@ -423,7 +423,7 @@ impl Version { /// Returns the local segments in this version, if any exist. #[inline] - pub fn local(&self) -> LocalVersionSlice { + pub fn local(&self) -> LocalVersionSlice<'_> { match self.inner { VersionInner::Small { ref small } => small.local_slice(), VersionInner::Full { ref full } => full.local.as_slice(), @@ -1405,7 +1405,7 @@ impl VersionSmall { } #[inline] - fn local_slice(&self) -> LocalVersionSlice { + fn local_slice(&self) -> LocalVersionSlice<'_> { if self.suffix_kind() == Self::SUFFIX_LOCAL { LocalVersionSlice::Max } else { @@ -2725,7 +2725,7 @@ pub(crate) fn compare_release(this: &[u64], other: &[u64]) -> Ordering { /// implementation /// /// [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, LocalVersionSlice) { +fn sortable_tuple(version: &Version) -> (u64, u64, Option, u64, LocalVersionSlice<'_>) { // If the version is a "max" version, use a post version larger than any possible post version. let post = if version.max().is_some() { Some(u64::MAX) diff --git a/crates/uv-pep440/src/version_specifier.rs b/crates/uv-pep440/src/version_specifier.rs index c632d3058..d57ace8a5 100644 --- a/crates/uv-pep440/src/version_specifier.rs +++ b/crates/uv-pep440/src/version_specifier.rs @@ -951,7 +951,7 @@ impl<'a> TildeVersionSpecifier<'a> { } /// 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(); if self.has_patch() { release.pop(); diff --git a/crates/uv-pep508/src/marker/tree.rs b/crates/uv-pep508/src/marker/tree.rs index d493fe4b1..ea175a309 100644 --- a/crates/uv-pep508/src/marker/tree.rs +++ b/crates/uv-pep508/src/marker/tree.rs @@ -3693,20 +3693,20 @@ mod test { let b = ExtraName::from_str("b").unwrap(); let marker = m("extra == 'a' and extra == 'b'"); - assert!(!marker.evaluate_only_extras(&[a.clone()])); - assert!(!marker.evaluate_only_extras(&[b.clone()])); + assert!(!marker.evaluate_only_extras(std::slice::from_ref(&a))); + assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b))); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); let marker = m("(platform_machine == 'inapplicable' and extra == 'b') or extra == 'a'"); - assert!(marker.evaluate_only_extras(&[a.clone()])); - assert!(!marker.evaluate_only_extras(&[b.clone()])); + assert!(marker.evaluate_only_extras(std::slice::from_ref(&a))); + assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b))); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); let marker = m( "(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(&[b.clone()])); + assert!(!marker.evaluate_only_extras(std::slice::from_ref(&a))); + assert!(!marker.evaluate_only_extras(std::slice::from_ref(&b))); assert!(marker.evaluate_only_extras(&[a.clone(), b.clone()])); } } diff --git a/crates/uv-pep508/src/verbatim_url.rs b/crates/uv-pep508/src/verbatim_url.rs index c25d40dd3..a236a35eb 100644 --- a/crates/uv-pep508/src/verbatim_url.rs +++ b/crates/uv-pep508/src/verbatim_url.rs @@ -524,7 +524,7 @@ pub fn looks_like_git_repository(url: &Url) -> bool { /// /// For example, given `file:///home/ferris/project/scripts#hash=somehash`, returns /// `("/home/ferris/project/scripts", Some("hash=somehash"))`. -fn split_fragment(path: &Path) -> (Cow, Option<&str>) { +fn split_fragment(path: &Path) -> (Cow<'_, Path>, Option<&str>) { let Some(s) = path.to_str() else { return (Cow::Borrowed(path), None); }; diff --git a/crates/uv-pypi-types/src/supported_environments.rs b/crates/uv-pypi-types/src/supported_environments.rs index 72c330ad1..59cbbf23b 100644 --- a/crates/uv-pypi-types/src/supported_environments.rs +++ b/crates/uv-pypi-types/src/supported_environments.rs @@ -25,7 +25,7 @@ impl SupportedEnvironments { } /// Returns an iterator over the marker trees. - pub fn iter(&self) -> std::slice::Iter { + pub fn iter(&self) -> std::slice::Iter<'_, MarkerTree> { self.0.iter() } } diff --git a/crates/uv-python/src/environment.rs b/crates/uv-python/src/environment.rs index 9c588d8e7..5b880f317 100644 --- a/crates/uv-python/src/environment.rs +++ b/crates/uv-python/src/environment.rs @@ -302,7 +302,7 @@ impl PythonEnvironment { /// /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we /// still deduplicate the entries, returning a single path. - pub fn site_packages(&self) -> impl Iterator> { + pub fn site_packages(&self) -> impl Iterator> { self.0.interpreter.site_packages() } diff --git a/crates/uv-python/src/interpreter.rs b/crates/uv-python/src/interpreter.rs index 3a7cce3f0..0f7a0f38d 100644 --- a/crates/uv-python/src/interpreter.rs +++ b/crates/uv-python/src/interpreter.rs @@ -567,7 +567,7 @@ impl Interpreter { /// /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we /// still deduplicate the entries, returning a single path. - pub fn site_packages(&self) -> impl Iterator> { + pub fn site_packages(&self) -> impl Iterator> { let target = self.target().map(Target::site_packages); let prefix = self diff --git a/crates/uv-python/src/sysconfig/parser.rs b/crates/uv-python/src/sysconfig/parser.rs index f505cc7d0..745cad89a 100644 --- a/crates/uv-python/src/sysconfig/parser.rs +++ b/crates/uv-python/src/sysconfig/parser.rs @@ -22,7 +22,7 @@ pub(super) struct SysconfigData(BTreeMap); impl SysconfigData { /// Returns an iterator over the key-value pairs in the map. - pub(super) fn iter_mut(&mut self) -> std::collections::btree_map::IterMut { + pub(super) fn iter_mut(&mut self) -> std::collections::btree_map::IterMut<'_, String, Value> { self.0.iter_mut() } diff --git a/crates/uv-resolver/src/candidate_selector.rs b/crates/uv-resolver/src/candidate_selector.rs index b10be99c0..dcab56c86 100644 --- a/crates/uv-resolver/src/candidate_selector.rs +++ b/crates/uv-resolver/src/candidate_selector.rs @@ -740,7 +740,7 @@ impl Name 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) } } diff --git a/crates/uv-resolver/src/lock/export/pylock_toml.rs b/crates/uv-resolver/src/lock/export/pylock_toml.rs index e9d337372..6f0225ae8 100644 --- a/crates/uv-resolver/src/lock/export/pylock_toml.rs +++ b/crates/uv-resolver/src/lock/export/pylock_toml.rs @@ -1306,7 +1306,7 @@ impl PylockTomlPackage { impl PylockTomlWheel { /// Return the [`WheelFilename`] for this wheel. - fn filename(&self, name: &PackageName) -> Result, PylockTomlErrorKind> { + fn filename(&self, name: &PackageName) -> Result, PylockTomlErrorKind> { if let Some(name) = self.name.as_ref() { Ok(Cow::Borrowed(name)) } else if let Some(path) = self.path.as_ref() { diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index 4eda53081..b3bd25447 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -3934,7 +3934,7 @@ enum SourceDist { } impl SourceDist { - fn filename(&self) -> Option> { + fn filename(&self) -> Option> { match self { Self::Metadata { .. } => None, Self::Url { url, .. } => url.filename().ok(), diff --git a/crates/uv-resolver/src/pubgrub/distribution.rs b/crates/uv-resolver/src/pubgrub/distribution.rs index c5208f9fb..125546a97 100644 --- a/crates/uv-resolver/src/pubgrub/distribution.rs +++ b/crates/uv-resolver/src/pubgrub/distribution.rs @@ -29,7 +29,7 @@ impl Name for PubGrubDistribution<'_> { } impl DistributionMetadata for PubGrubDistribution<'_> { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { match self { Self::Registry(_, version) => VersionOrUrlRef::Version(version), Self::Url(_, url) => VersionOrUrlRef::Url(&url.verbatim), diff --git a/crates/uv-resolver/src/resolution/mod.rs b/crates/uv-resolver/src/resolution/mod.rs index 6c8f0b6aa..59dc6ccb9 100644 --- a/crates/uv-resolver/src/resolution/mod.rs +++ b/crates/uv-resolver/src/resolution/mod.rs @@ -75,7 +75,7 @@ impl Name for AnnotatedDist { } impl DistributionMetadata for AnnotatedDist { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { self.dist.version_or_url() } } diff --git a/crates/uv-resolver/src/resolution/requirements_txt.rs b/crates/uv-resolver/src/resolution/requirements_txt.rs index bcdef207b..bfb4caef6 100644 --- a/crates/uv-resolver/src/resolution/requirements_txt.rs +++ b/crates/uv-resolver/src/resolution/requirements_txt.rs @@ -36,7 +36,7 @@ impl<'dist> RequirementsTxtDist<'dist> { &self, requires_python: &RequiresPython, include_markers: bool, - ) -> Cow { + ) -> Cow<'_, str> { // If the URL is editable, write it as an editable requirement. if self.dist.is_editable() { 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 /// 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 let VersionOrUrlRef::Url(url) = self.dist.version_or_url() { return RequirementsTxtComparator::Url(url.verbatim()); @@ -213,7 +213,7 @@ impl Name for RequirementsTxtDist<'_> { } impl DistributionMetadata for RequirementsTxtDist<'_> { - fn version_or_url(&self) -> VersionOrUrlRef { + fn version_or_url(&self) -> VersionOrUrlRef<'_> { self.dist.version_or_url() } } diff --git a/crates/uv-resolver/src/version_map.rs b/crates/uv-resolver/src/version_map.rs index 4b0e07ad8..0da5dc4d7 100644 --- a/crates/uv-resolver/src/version_map.rs +++ b/crates/uv-resolver/src/version_map.rs @@ -174,7 +174,7 @@ impl VersionMap { pub(crate) fn iter( &self, range: &Ranges, - ) -> impl DoubleEndedIterator { + ) -> impl DoubleEndedIterator)> { // Performance optimization: If we only have a single version, return that version directly. if let Some(version) = range.as_singleton() { either::Either::Left(match self.inner { diff --git a/crates/uv-types/src/hash.rs b/crates/uv-types/src/hash.rs index fe472b349..9d48c8221 100644 --- a/crates/uv-types/src/hash.rs +++ b/crates/uv-types/src/hash.rs @@ -32,7 +32,7 @@ pub enum HashStrategy { impl HashStrategy { /// Return the [`HashPolicy`] for the given distribution. - pub fn get(&self, distribution: &T) -> HashPolicy { + pub fn get(&self, distribution: &T) -> HashPolicy<'_> { match self { Self::None => HashPolicy::None, Self::Generate(mode) => HashPolicy::Generate(*mode), @@ -53,7 +53,7 @@ impl HashStrategy { } /// 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 { Self::None => HashPolicy::None, Self::Generate(mode) => HashPolicy::Generate(*mode), @@ -76,7 +76,7 @@ impl HashStrategy { } /// 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 { Self::None => HashPolicy::None, Self::Generate(mode) => HashPolicy::Generate(*mode), diff --git a/crates/uv-workspace/src/dependency_groups.rs b/crates/uv-workspace/src/dependency_groups.rs index 7f58e4170..4196ea6c5 100644 --- a/crates/uv-workspace/src/dependency_groups.rs +++ b/crates/uv-workspace/src/dependency_groups.rs @@ -225,7 +225,7 @@ impl FlatDependencyGroups { } /// Return the entry for a given group, if any. - pub fn entry(&mut self, group: GroupName) -> Entry { + pub fn entry(&mut self, group: GroupName) -> Entry<'_, GroupName, FlatDependencyGroup> { self.0.entry(group) } diff --git a/crates/uv/src/commands/project/sync.rs b/crates/uv/src/commands/project/sync.rs index 1c6242a61..7cc8a2aad 100644 --- a/crates/uv/src/commands/project/sync.rs +++ b/crates/uv/src/commands/project/sync.rs @@ -546,8 +546,8 @@ impl Deref for SyncEnvironment { fn deref(&self) -> &Self::Target { match self { - Self::Project(environment) => Deref::deref(environment), - Self::Script(environment) => Deref::deref(environment), + Self::Project(environment) => environment, + Self::Script(environment) => environment, } } } diff --git a/crates/uv/src/commands/self_update.rs b/crates/uv/src/commands/self_update.rs index 4b4fd4830..13012288a 100644 --- a/crates/uv/src/commands/self_update.rs +++ b/crates/uv/src/commands/self_update.rs @@ -25,9 +25,7 @@ pub(crate) async fn self_update( printer.stderr(), "{}", 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(), ":".bold() ) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c95c90571..4f3e8c521 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.88" +channel = "1.89"