From ccf85bffd57a5fdeb2712921d045a6ff80b1fc38 Mon Sep 17 00:00:00 2001 From: Martin Indra Date: Sat, 7 Oct 2023 18:34:20 +0200 Subject: [PATCH] Fix a Clippy warning 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 { | | _____________________________________________________________- 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. --- crates/uom/src/quantity.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/uom/src/quantity.rs b/crates/uom/src/quantity.rs index b62e3886e..e1921b441 100644 --- a/crates/uom/src/quantity.rs +++ b/crates/uom/src/quantity.rs @@ -89,11 +89,7 @@ impl Eq for Quantity {} impl PartialOrd for Quantity { fn partial_cmp(&self, other: &Self) -> Option { - #[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)) } }