Skip to content

Commit

Permalink
fix non_canonical_partial_ord_impl to ensure PartialOrd and Ord agree
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyandrews committed Oct 31, 2023
1 parent e7aea3b commit 10c4589
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,16 +570,7 @@ impl<T: Clone + TimeSeriesValue<T, U>, U: PartialEq + PartialOrd> Ord for TimeSe

impl<T: Clone + TimeSeriesValue<T, U>, U: PartialEq + PartialOrd> PartialOrd for TimeSeries<T, U> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
let self_total = self.total();
let other_total = other.total();

if self_total > other_total {
Some(Ordering::Greater)
} else if self_total < other_total {
Some(Ordering::Less)
} else {
Some(Ordering::Equal)
}
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit 10c4589

Please sign in to comment.