Skip to content

Commit

Permalink
Fix clippy, remove partial ord from babybear (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
MauroToscano authored Oct 5, 2023
1 parent f050c5c commit bea1b8d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
12 changes: 0 additions & 12 deletions math/src/field/fields/fft_friendly/babybear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ impl FieldElement<Babybear31PrimeField> {
}
}

impl PartialOrd for FieldElement<Babybear31PrimeField> {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.representative().partial_cmp(&other.representative())
}
}

impl Ord for FieldElement<Babybear31PrimeField> {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.representative().cmp(&other.representative())
}
}

#[cfg(test)]
mod test_babybear_31_bytes_ops {
use super::Babybear31PrimeField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ impl FieldElement<Stark252PrimeField> {
}
}

#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
impl PartialOrd for FieldElement<Stark252PrimeField> {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.representative().partial_cmp(&other.representative())
Expand Down
1 change: 1 addition & 0 deletions math/src/unsigned_integer/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct UnsignedInteger<const NUM_LIMBS: usize> {

// NOTE: manually implementing `PartialOrd` may seem unorthodox, but the
// derived implementation had terrible performance.
#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
impl<const NUM_LIMBS: usize> PartialOrd for UnsignedInteger<NUM_LIMBS> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
let mut i = 0;
Expand Down

0 comments on commit bea1b8d

Please sign in to comment.