From c1b1eac970e6767e9084c156b6a34662b73e2a9d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 17 Jul 2023 21:10:56 -0700 Subject: [PATCH] Resolve incorrect_partial_ord_impl_on_ord_type clippy lint warning: incorrect implementation of `partial_cmp` on an `Ord` type --> src/value/tagged.rs:150:1 | 150 | / impl PartialOrd for Tag { 151 | | fn partial_cmp(&self, other: &Self) -> Option { | | _____________________________________________________________- 152 | || Some(Ord::cmp(self, other)) 153 | || } | ||_____- help: change this to: `{ Some(self.cmp(other)) }` 154 | | } | |__^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type = note: `-W clippy::incorrect-partial-ord-impl-on-ord-type` implied by `-W clippy::all` --- src/value/tagged.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/value/tagged.rs b/src/value/tagged.rs index d5e5aedc..baf6a0ae 100644 --- a/src/value/tagged.rs +++ b/src/value/tagged.rs @@ -149,7 +149,7 @@ impl Ord for Tag { impl PartialOrd for Tag { fn partial_cmp(&self, other: &Self) -> Option { - PartialOrd::partial_cmp(nobang(&self.string), nobang(&other.string)) + Some(self.cmp(other)) } }