diff --git a/.github/workflows/rustico.yml b/.github/workflows/rustico.yml index 302d2c8..3c313e0 100644 --- a/.github/workflows/rustico.yml +++ b/.github/workflows/rustico.yml @@ -15,7 +15,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Linting + run: cargo clippy - name: Building - run: cargo build + run: cargo build --release --all-features - name: Testing run: cargo test diff --git a/src/primefield/mod.rs b/src/primefield/mod.rs index 5b9b068..bddd267 100644 --- a/src/primefield/mod.rs +++ b/src/primefield/mod.rs @@ -44,9 +44,8 @@ impl Fp { /// The `modulus` should be a prime number. pub fn new(modulus: BigUint) -> Self { // TODO: verify whether p is prime. - let p = modulus.to_bigint().unwrap(); Fp(Arc::new(Params { - p: p.clone(), + p: modulus.to_bigint().unwrap(), sqrt_precmp: AtomicRefCell::new(None), })) } diff --git a/src/quadraticfield/mod.rs b/src/quadraticfield/mod.rs index 541baa3..95a7ed0 100644 --- a/src/quadraticfield/mod.rs +++ b/src/quadraticfield/mod.rs @@ -118,7 +118,7 @@ impl_from_factory!(Fp2, ); impl FromFactory<&str> for Fp2 { type Output = ::Elt; fn from(&self, s: &str) -> Self::Output { - let vs: Vec<&str> = s.splitn(2, ",").collect(); + let vs: Vec<&str> = s.splitn(2, ',').collect(); let n0: FpElt = self.0.base.from(vs[0]); let n1: FpElt = self.0.base.from(vs[1]); Fp2Elt { @@ -242,7 +242,7 @@ impl<'a, 'b> BitXor<&'b BigUint> for &'a Fp2Elt { let v = exp.to_u32_digits(); let mut out = Fp2Elt::one(); for vi in v.iter().rev() { - for j in 31..0 { + for j in (0..31).rev() { out = &out * &out; let bit = (*vi >> j) & 1; if bit == 1 {