Skip to content

Commit

Permalink
Simplify Ord for Number
Browse files Browse the repository at this point in the history
  • Loading branch information
artemshein committed May 13, 2019
1 parent ae3c8b9 commit 1bb5633
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ impl PartialOrd for Number {
/// It is not the case for underlying `f64` values itself. See the `PartialEq` implementation.
impl Ord for Number {
fn cmp(&self, other: &Self) -> Ordering {
match (self.0.is_nan(), other.0.is_nan()) {
(true, true) => Ordering::Equal,
(true, false) => Ordering::Less,
(false, true) => Ordering::Greater,
_ => self.partial_cmp(other).expect("Bug: Contract violation")
}
self.partial_cmp(other).expect("Bug: Contract violation")
}
}

Expand Down

0 comments on commit 1bb5633

Please sign in to comment.