Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 24, 2024
1 parent 6f9a29c commit d96fabc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
20 changes: 14 additions & 6 deletions crates/pep440-rs/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ impl Version {
}

/// Returns the min-release part of this version, if it exists.
///
/// The "min" component is internal-only, and does not exist in PEP 440.
/// The version `1.0min0` is smaller than all other `1.0` versions,
/// like `1.0a1`, `1.0dev0`, etc.
#[inline]
pub fn min(&self) -> Option<u64> {
match *self.inner {
Expand Down Expand Up @@ -523,7 +527,9 @@ impl Version {

/// Set the min-release component and return the updated version.
///
/// The min component is internal-only, and does not exist in PEP 440.
/// The "min" component is internal-only, and does not exist in PEP 440.
/// The version `1.0min0` is smaller than all other `1.0` versions,
/// like `1.0a1`, `1.0dev0`, etc.
#[inline]
pub fn with_min(mut self, value: Option<u64>) -> Version {
if let VersionInner::Small { ref mut small } = Arc::make_mut(&mut self.inner) {
Expand Down Expand Up @@ -1126,7 +1132,6 @@ struct VersionFull {
/// release](https://peps.python.org/pep-0440/#developmental-releases),
/// if any
dev: Option<u64>,
/// An internal-only segment that does not exist in PEP 440, used to
/// A [local version
/// identifier](https://peps.python.org/pep-0440/#local-version-identif
/// iers) such as `+deadbeef` in `1.2.3+deadbeef`
Expand All @@ -1137,8 +1142,9 @@ struct VersionFull {
/// > Local version labels have no specific semantics assigned, but
/// > some syntactic restrictions are imposed.
local: Vec<LocalSegment>,
/// represent the smallest possible version, preceding any `dev`,
/// `pre`, `post` or releases.
/// An internal-only segment that does not exist in PEP 440, used to
/// represent the smallest possible version of a release, preceding any
/// `dev`, `pre`, `post` or releases.
min: Option<u64>,
}

Expand Down Expand Up @@ -2328,7 +2334,7 @@ fn sortable_tuple(version: &Version) -> (u64, u64, Option<u64>, u64, &[LocalSegm
}),
post,
dev,
None
None,
) => (2, n, post, dev.unwrap_or(u64::MAX), version.local()),
// beta release
(
Expand All @@ -2353,7 +2359,9 @@ fn sortable_tuple(version: &Version) -> (u64, u64, Option<u64>, u64, &[LocalSegm
// final release
(None, None, None, None) => (5, 0, None, 0, version.local()),
// post release
(None, Some(post), dev, None) => (6, 0, Some(post), dev.unwrap_or(u64::MAX), version.local()),
(None, Some(post), dev, None) => {
(6, 0, Some(post), dev.unwrap_or(u64::MAX), version.local())
}
}
}

Expand Down
20 changes: 9 additions & 11 deletions crates/uv-resolver/src/pubgrub/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use uv_normalize::{ExtraName, PackageName};

use crate::constraints::Constraints;
use crate::overrides::Overrides;
use crate::pubgrub::PubGrubPackage;
use crate::pubgrub::specifier::PubGrubSpecifier;
use crate::ResolveError;
use crate::pubgrub::PubGrubPackage;
use crate::resolver::Urls;
use crate::ResolveError;

#[derive(Debug)]
pub struct PubGrubDependencies(Vec<(PubGrubPackage, Range<Version>)>);
Expand Down Expand Up @@ -80,15 +80,13 @@ impl PubGrubDependencies {
}

// Add the package, plus any extra variants.
for result in std::iter::once(to_pubgrub(constraint, None, urls))
.chain(
constraint
.extras
.clone()
.into_iter()
.map(|extra| to_pubgrub(constraint, Some(extra), urls)),
)
{
for result in std::iter::once(to_pubgrub(constraint, None, urls)).chain(
constraint
.extras
.clone()
.into_iter()
.map(|extra| to_pubgrub(constraint, Some(extra), urls)),
) {
let (mut package, version) = result?;

// Detect self-dependencies.
Expand Down

0 comments on commit d96fabc

Please sign in to comment.