From 7d612425728a9d5852ec26a96af629aec7cd0a21 Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Mon, 25 Nov 2024 11:56:12 -0300 Subject: [PATCH] chore: derive PartialEq and Hash for FieldElement (#6610) --- acvm-repo/acir_field/src/field_element.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/acvm-repo/acir_field/src/field_element.rs b/acvm-repo/acir_field/src/field_element.rs index 01b9bf8881d..0249b410aa7 100644 --- a/acvm-repo/acir_field/src/field_element.rs +++ b/acvm-repo/acir_field/src/field_element.rs @@ -9,7 +9,7 @@ use crate::AcirField; // XXX: Switch out for a trait and proper implementations // This implementation is inefficient, can definitely remove hex usage and Iterator instances for trivial functionality -#[derive(Default, Clone, Copy, Eq, PartialOrd, Ord)] +#[derive(Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct FieldElement(F); impl std::fmt::Display for FieldElement { @@ -43,18 +43,6 @@ impl std::fmt::Debug for FieldElement { } } -impl std::hash::Hash for FieldElement { - fn hash(&self, state: &mut H) { - state.write(&self.to_be_bytes()); - } -} - -impl PartialEq for FieldElement { - fn eq(&self, other: &Self) -> bool { - self.to_be_bytes() == other.to_be_bytes() - } -} - impl From for FieldElement { fn from(mut a: i128) -> FieldElement { let mut negative = false;