Skip to content

Commit

Permalink
refactor(resolver): Allow scaling number of sort cases
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 8, 2023
1 parent 87ca386 commit 2c5ddc0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/cargo/core/resolver/version_prefs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,14 @@ impl VersionPreferences {
let prefer_a = should_prefer(&a.package_id());
let prefer_b = should_prefer(&b.package_id());
let previous_cmp = prefer_a.cmp(&prefer_b).reverse();
match previous_cmp {
Ordering::Equal => {
let cmp = a.version().cmp(b.version());
match first_version.unwrap_or(self.version_ordering) {
VersionOrdering::MaximumVersionsFirst => cmp.reverse(),
VersionOrdering::MinimumVersionsFirst => cmp,
}
}
_ => previous_cmp,
if previous_cmp != Ordering::Equal {
return previous_cmp;
}

let cmp = a.version().cmp(b.version());
match first_version.unwrap_or(self.version_ordering) {
VersionOrdering::MaximumVersionsFirst => cmp.reverse(),
VersionOrdering::MinimumVersionsFirst => cmp,
}
});
if first_version.is_some() {
Expand Down

0 comments on commit 2c5ddc0

Please sign in to comment.