From bea1b8d6fe02e955084d82d6cf4a7f5ee1ce84c3 Mon Sep 17 00:00:00 2001 From: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:11:55 -0300 Subject: [PATCH] Fix clippy, remove partial ord from babybear (#591) --- math/src/field/fields/fft_friendly/babybear.rs | 12 ------------ .../fields/fft_friendly/stark_252_prime_field.rs | 1 + math/src/unsigned_integer/element.rs | 1 + 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/math/src/field/fields/fft_friendly/babybear.rs b/math/src/field/fields/fft_friendly/babybear.rs index 1dcefc28d..68da03f91 100644 --- a/math/src/field/fields/fft_friendly/babybear.rs +++ b/math/src/field/fields/fft_friendly/babybear.rs @@ -30,18 +30,6 @@ impl FieldElement { } } -impl PartialOrd for FieldElement { - fn partial_cmp(&self, other: &Self) -> Option { - self.representative().partial_cmp(&other.representative()) - } -} - -impl Ord for FieldElement { - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - self.representative().cmp(&other.representative()) - } -} - #[cfg(test)] mod test_babybear_31_bytes_ops { use super::Babybear31PrimeField; diff --git a/math/src/field/fields/fft_friendly/stark_252_prime_field.rs b/math/src/field/fields/fft_friendly/stark_252_prime_field.rs index abea28907..0703a97f6 100644 --- a/math/src/field/fields/fft_friendly/stark_252_prime_field.rs +++ b/math/src/field/fields/fft_friendly/stark_252_prime_field.rs @@ -63,6 +63,7 @@ impl FieldElement { } } +#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)] impl PartialOrd for FieldElement { fn partial_cmp(&self, other: &Self) -> Option { self.representative().partial_cmp(&other.representative()) diff --git a/math/src/unsigned_integer/element.rs b/math/src/unsigned_integer/element.rs index d76e54ec7..fab80ce6f 100644 --- a/math/src/unsigned_integer/element.rs +++ b/math/src/unsigned_integer/element.rs @@ -36,6 +36,7 @@ pub struct UnsignedInteger { // NOTE: manually implementing `PartialOrd` may seem unorthodox, but the // derived implementation had terrible performance. +#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)] impl PartialOrd for UnsignedInteger { fn partial_cmp(&self, other: &Self) -> Option { let mut i = 0;