use Ordering::then_wtth

This commit is contained in:
adamnemecek 2025-10-14 16:23:33 -07:00
parent 67aaca98f5
commit a13c9ca6ae

View File

@ -112,12 +112,10 @@ impl PartialOrd for MergeJob {
impl Ord for MergeJob { impl Ord for MergeJob {
fn cmp(&self, other: &Self) -> Ordering { fn cmp(&self, other: &Self) -> Ordering {
// Max-heap by count; tie-break to ascending pair order (deterministic) // Max-heap by count; tie-break to ascending pair order (deterministic)
if self.count != other.count { self.count.cmp(&other.count).then_with(||
self.count.cmp(&other.count)
} else {
// ascending order on the pair when counts tie // ascending order on the pair when counts tie
other.pair.cmp(&self.pair) other.pair.cmp(&self.pair)
} )
} }
} }