From a13c9ca6ae81b690284183977d6d0aef33e52481 Mon Sep 17 00:00:00 2001 From: adamnemecek Date: Tue, 14 Oct 2025 16:23:33 -0700 Subject: [PATCH] use Ordering::then_wtth --- rustbpe/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rustbpe/src/lib.rs b/rustbpe/src/lib.rs index b43fb6c..3605072 100644 --- a/rustbpe/src/lib.rs +++ b/rustbpe/src/lib.rs @@ -112,12 +112,10 @@ impl PartialOrd for MergeJob { impl Ord for MergeJob { fn cmp(&self, other: &Self) -> Ordering { // Max-heap by count; tie-break to ascending pair order (deterministic) - if self.count != other.count { - self.count.cmp(&other.count) - } else { + self.count.cmp(&other.count).then_with(|| // ascending order on the pair when counts tie other.pair.cmp(&self.pair) - } + ) } }