Skip to content

Commit

Permalink
Fix a Clippy warning
Browse files Browse the repository at this point in the history
error: incorrect implementation of `partial_cmp` on an `Ord` type
  --> crates/types/src/player.rs:43:1
   |
43 | /  impl PartialOrd for Player {
44 | |      fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
   | | _____________________________________________________________-
45 | ||         self.to_num().partial_cmp(&other.to_num())
46 | ||     }
   | ||_____- help: change this to: `{ Some(self.cmp(other)) }`
47 | |  }
   | |__^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type
   = note: `#[deny(clippy::incorrect_partial_ord_impl_on_ord_type)]` on by default

error: could not compile `de_types` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.
  • Loading branch information
Indy2222 committed Oct 7, 2023
1 parent ab3ba9b commit ccf85bf
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions crates/uom/src/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ impl<const U: Unit> Eq for Quantity<U> {}

impl<const U: Unit> PartialOrd for Quantity<U> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
#[cfg(debug_assertions)]
panic_on_invalid(self.0);
#[cfg(debug_assertions)]
panic_on_invalid(other.0);
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit ccf85bf

Please sign in to comment.