Skip to content

Commit

Permalink
clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
supinie committed Jan 5, 2024
1 parent 3ca244e commit e59a564
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/polynomials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Poly {
// Example:
// poly.normalise();
pub(crate) fn normalise(&mut self) {
for coeff in self.coeffs.iter_mut() {
for coeff in &mut self.coeffs {
*coeff = conditional_sub_q(barrett_reduce(*coeff));
}
}
Expand All @@ -64,7 +64,7 @@ impl Poly {
// Example:
// poly.reduce();
pub(crate) fn reduce(&mut self) {
for coeff in self.coeffs.iter_mut() {
for coeff in &mut self.coeffs {
*coeff = barrett_reduce(*coeff);
}
}
Expand All @@ -73,7 +73,7 @@ impl Poly {
// Example:
// poly.mont_form();
pub(crate) fn mont_form(&mut self) {
for coeff in self.coeffs.iter_mut() {
for coeff in &mut self.coeffs {
*coeff = mont_form(*coeff);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sample.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{params::*, polynomials::Poly};
use crate::{params::Eta, polynomials::Poly};
use core::num::TryFromIntError;
use sha3::{digest::{Update, ExtendableOutput, XofReader}, Shake256};
use byteorder::{ByteOrder, LittleEndian};
Expand Down
14 changes: 7 additions & 7 deletions src/vectors.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::polynomials::Poly;
use crate::params::{K, Eta};
pub(crate) use arrayvec::ArrayVec as PolyVec;
pub use arrayvec::ArrayVec as PolyVec;

pub(crate) type PolyVec512 = PolyVec<Poly, 2>;
pub(crate) type PolyVec768 = PolyVec<Poly, 3>;
pub(crate) type PolyVec1024 = PolyVec<Poly, 4>;
pub type PolyVec512 = PolyVec<Poly, 2>;
pub type PolyVec768 = PolyVec<Poly, 3>;
pub type PolyVec1024 = PolyVec<Poly, 4>;

trait SameSecLevel {}

pub(crate) trait PolyVecOperations {
pub trait PolyVecOperations {
fn add(&mut self, addend: Self);
fn reduce(&mut self);
fn normalise(&mut self);
Expand Down Expand Up @@ -68,9 +68,9 @@ impl_polyvec!(PolyVec1024);


impl Poly {
pub(crate) fn inner_product_pointwise<T>(&mut self, multiplicand: T, multiplier: T)
pub fn inner_product_pointwise<T>(&mut self, multiplicand: T, multiplier: T)
where
T: PolyVecOperations + IntoIterator<Item = Poly>,
T: PolyVecOperations + IntoIterator<Item = Self>,
{
let mut temp = Self::new();
*self = Self::new(); // Zero output Poly
Expand Down

0 comments on commit e59a564

Please sign in to comment.