modes:pair: adjust Ord impl for Pair

Instead of doing a deep-check where we compare their best member
before their worst member, we just compare by the best member.

This allows (Joker, 4S) to be equal to (4C, 4S).
This commit is contained in:
2026-04-02 06:14:54 +01:00
committed by oreodave
parent a24d85572d
commit 0267a6f567

View File

@@ -50,12 +50,8 @@ use std::cmp::Ordering;
impl Ord for Pair { impl Ord for Pair {
fn cmp(&self, other: &Self) -> Ordering { fn cmp(&self, other: &Self) -> Ordering {
match (self.0.cmp(&other.0), self.1.cmp(&other.1)) { // We order pairs by their "best" member i.e. Pair::1
// If Pair::1 are equal, then it's dependent on Pair::0 self.1.cmp(&other.1)
(x, Ordering::Equal) => x,
// Otherwise leave it to Pair::1
(_, x) => x,
}
} }
} }