Skip to content

Commit f36b265

Browse files
authored
fix clippy warnings (#72)
1 parent 1e60918 commit f36b265

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

src/dense_mlpoly.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ mod tests {
416416
// compute n = 2^\ell
417417
let n = ell.pow2();
418418
// compute m = sqrt(n) = 2^{\ell/2}
419-
let m = n.square_root();
419+
let m = (n as f64).sqrt() as usize;
420420

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

460460
// compute row vector L
461461
for i in 0..m {

src/math.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
pub trait Math {
2-
fn square_root(self) -> usize;
32
fn pow2(self) -> usize;
43
fn get_bits(self, num_bits: usize) -> Vec<bool>;
54
fn log_2(self) -> usize;
65
}
76

87
impl Math for usize {
9-
#[inline]
10-
fn square_root(self) -> usize {
11-
(self as f64).sqrt() as usize
12-
}
13-
148
#[inline]
159
fn pow2(self) -> usize {
1610
let base: usize = 2;

src/scalar/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,10 @@ impl ScalarFromPrimitives for bool {
2727

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

3332
impl ScalarBytesFromScalar for Scalar {
3433
fn decompress_scalar(s: &Scalar) -> ScalarBytes {
3534
ScalarBytes::from_bytes_mod_order(s.to_bytes())
3635
}
37-
38-
fn decompress_vector(s: &[Scalar]) -> Vec<ScalarBytes> {
39-
(0..s.len())
40-
.map(|i| Scalar::decompress_scalar(&s[i]))
41-
.collect::<Vec<ScalarBytes>>()
42-
}
4336
}

0 commit comments

Comments
 (0)