Compare commits

..

2 Commits

Author SHA1 Message Date
Kris Nuttycombe adc543c29a
Merge 3619a58118 into 5805178fc7 2024-03-15 15:17:41 +00:00
Kris Nuttycombe 3619a58118 Implement `{PartialOrd, Ord, Hash}` for `DiversifierIndex` 2024-03-15 09:17:12 -06:00
1 changed files with 5 additions and 8 deletions

View File

@ -222,15 +222,12 @@ impl PartialOrd for DiversifierIndex {
impl Ord for DiversifierIndex {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.0
.iter()
.rev()
.zip(other.0.iter().rev())
.find_map(|(a, b)| match a.cmp(b) {
self.0.iter().rev().zip(other.0.iter().rev()).find_map(|(a, b)|
match a.cmp(b) {
core::cmp::Ordering::Equal => None,
ineq => Some(ineq),
})
.unwrap_or(core::cmp::Ordering::Equal)
ineq => Some(ineq)
}
).unwrap_or(core::cmp::Ordering::Equal)
}
}