Skip to content

Commit

Permalink
fix clippy warnings (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinathsetty authored Sep 19, 2024
1 parent 1e60918 commit f36b265
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/dense_mlpoly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ mod tests {
// compute n = 2^\ell
let n = ell.pow2();
// compute m = sqrt(n) = 2^{\ell/2}
let m = n.square_root();
let m = (n as f64).sqrt() as usize;

// compute vector-matrix product between L and Z viewed as a matrix
let LZ = (0..m)
Expand Down Expand Up @@ -455,7 +455,7 @@ mod tests {
let ell = r.len();
assert!(ell % 2 == 0); // ensure ell is even
let n = ell.pow2();
let m = n.square_root();
let m = (n as f64).sqrt() as usize;

// compute row vector L
for i in 0..m {
Expand Down
6 changes: 0 additions & 6 deletions src/math.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
pub trait Math {
fn square_root(self) -> usize;
fn pow2(self) -> usize;
fn get_bits(self, num_bits: usize) -> Vec<bool>;
fn log_2(self) -> usize;
}

impl Math for usize {
#[inline]
fn square_root(self) -> usize {
(self as f64).sqrt() as usize
}

#[inline]
fn pow2(self) -> usize {
let base: usize = 2;
Expand Down
7 changes: 0 additions & 7 deletions src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,10 @@ impl ScalarFromPrimitives for bool {

pub trait ScalarBytesFromScalar {
fn decompress_scalar(s: &Scalar) -> ScalarBytes;
fn decompress_vector(s: &[Scalar]) -> Vec<ScalarBytes>;
}

impl ScalarBytesFromScalar for Scalar {
fn decompress_scalar(s: &Scalar) -> ScalarBytes {
ScalarBytes::from_bytes_mod_order(s.to_bytes())
}

fn decompress_vector(s: &[Scalar]) -> Vec<ScalarBytes> {
(0..s.len())
.map(|i| Scalar::decompress_scalar(&s[i]))
.collect::<Vec<ScalarBytes>>()
}
}

0 comments on commit f36b265

Please sign in to comment.