clippy::non-canonical-partial-ord-impl warns if self.cmp(other).into()
instead of Some(self.cmp(other))
is used
#13640
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
The lint causes a warning if
self.cmp(other).into()
is used inside thePartialEq::partial_cmp()
implementation instead of usingSome(self.cmp(other))
.Lint Name
clippy::non-canonical-partial-ord-impl
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warningg, because
self.cmp(other).into()
is equivalent toSome(self.cmp(other))
in this context.Version
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1
Additional Labels
No response
The text was updated successfully, but these errors were encountered: