From fe28029acbea9562eef8a29ddb5a81f7ef703da7 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 8 Jan 2024 00:28:12 +0000 Subject: [PATCH] clippy --- banderwagon/src/element.rs | 2 +- banderwagon/src/lib.rs | 2 +- banderwagon/src/trait_impls/serialise.rs | 2 +- ipa-multipoint/src/crs.rs | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/banderwagon/src/element.rs b/banderwagon/src/element.rs index 27308f4..22b38ba 100644 --- a/banderwagon/src/element.rs +++ b/banderwagon/src/element.rs @@ -138,7 +138,7 @@ fn legendre_check_point(x: &Fq) -> bool { } pub fn multi_scalar_mul(bases: &[Element], scalars: &[Fr]) -> Element { - let bases_inner: Vec<_> = bases.into_iter().map(|element| element.0).collect(); + let bases_inner: Vec<_> = bases.iter().map(|element| element.0).collect(); // XXX: Converting all of these to affine hurts performance let bases = EdwardsProjective::batch_convert_to_mul_base(&bases_inner); diff --git a/banderwagon/src/lib.rs b/banderwagon/src/lib.rs index a10dbb6..b313440 100644 --- a/banderwagon/src/lib.rs +++ b/banderwagon/src/lib.rs @@ -51,7 +51,7 @@ pub fn try_reduce_to_element(bytes: &[u8]) -> Option { // The Element::from_bytes method does not reduce the bytes, it expects the // input to be in a canonical format, so we must do the reduction ourselves - let x_coord = Fq::from_be_bytes_mod_order(&bytes); + let x_coord = Fq::from_be_bytes_mod_order(bytes); let mut bytes = [0u8; 32]; x_coord.serialize_compressed(&mut bytes[..]).unwrap(); diff --git a/banderwagon/src/trait_impls/serialise.rs b/banderwagon/src/trait_impls/serialise.rs index bc445d9..8938dfe 100644 --- a/banderwagon/src/trait_impls/serialise.rs +++ b/banderwagon/src/trait_impls/serialise.rs @@ -10,7 +10,7 @@ impl CanonicalSerialize for Element { ) -> Result<(), SerializationError> { match compress { ark_serialize::Compress::Yes => { - writer.write(&self.to_bytes())?; + writer.write_all(&self.to_bytes())?; Ok(()) } ark_serialize::Compress::No => self.0.into_affine().serialize_uncompressed(writer), diff --git a/ipa-multipoint/src/crs.rs b/ipa-multipoint/src/crs.rs index 3bded98..6b29d87 100644 --- a/ipa-multipoint/src/crs.rs +++ b/ipa-multipoint/src/crs.rs @@ -1,6 +1,7 @@ use crate::{ipa::slow_vartime_multiscalar_mul, lagrange_basis::LagrangeBasis}; use banderwagon::{try_reduce_to_element, Element}; +#[allow(non_snake_case)] #[derive(Debug, Clone)] pub struct CRS { pub n: usize, @@ -9,6 +10,7 @@ pub struct CRS { } impl CRS { + #[allow(non_snake_case)] pub fn new(n: usize, seed: &'static [u8]) -> CRS { // TODO generate the Q value from the seed also // TODO: this will also make assert_dedup work as expected