Make PartialOrd implementations match Ord

Clippy starts detecting this in Rust 1.73.0.
This commit is contained in:
Hanno Braun 2023-10-06 17:37:21 +02:00
parent 70fcd95577
commit 45b6bb4e7c
3 changed files with 4 additions and 4 deletions

View File

@ -158,7 +158,7 @@ impl<T: CurveBoundaryElement> Ord for CurveBoundary<T> {
impl<T: CurveBoundaryElement> PartialOrd for CurveBoundary<T> { impl<T: CurveBoundaryElement> PartialOrd for CurveBoundary<T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.inner.partial_cmp(&other.inner) Some(self.cmp(other))
} }
} }

View File

@ -245,7 +245,7 @@ impl<T> Ord for HandleWrapper<T> {
impl<T> PartialOrd for HandleWrapper<T> { impl<T> PartialOrd for HandleWrapper<T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.id().partial_cmp(&other.0.id()) Some(self.cmp(other))
} }
} }

View File

@ -160,7 +160,7 @@ impl Eq for Scalar {}
impl PartialOrd for Scalar { impl PartialOrd for Scalar {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.0.partial_cmp(&other.0) Some(self.cmp(other))
} }
} }
@ -168,7 +168,7 @@ impl Ord for Scalar {
fn cmp(&self, other: &Self) -> cmp::Ordering { fn cmp(&self, other: &Self) -> cmp::Ordering {
// Should never panic, as `from_f64` checks that the wrapped value is // Should never panic, as `from_f64` checks that the wrapped value is
// finite. // finite.
self.partial_cmp(other).expect("Invalid `Scalar`") self.0.partial_cmp(&other.0).expect("Invalid `Scalar`")
} }
} }