diff --git a/utils/src/chunked_polynomial.rs b/utils/src/chunked_polynomial.rs index 86f64a6b3cf..7bc8a575c3c 100644 --- a/utils/src/chunked_polynomial.rs +++ b/utils/src/chunked_polynomial.rs @@ -42,7 +42,7 @@ impl ChunkedPolynomial { scale *= zeta_n; } - while coeffs.last().map_or(false, |c| c.is_zero()) { + while coeffs.last().is_some_and(|c| c.is_zero()) { coeffs.pop(); } diff --git a/utils/src/foreign_field.rs b/utils/src/foreign_field.rs index fb05f4eb0db..8da5773c43d 100644 --- a/utils/src/foreign_field.rs +++ b/utils/src/foreign_field.rs @@ -77,7 +77,7 @@ impl ForeignElement { /// Obtains the big integer representation of the foreign field element pub fn to_biguint(&self) -> BigUint { let mut bytes = vec![]; - if B % 8 == 0 { + if B.is_multiple_of(8) { // limbs are stored in little endian for limb in self.limbs { let crumb = &limb.to_bytes()[0..B / 8]; @@ -91,7 +91,7 @@ impl ForeignElement { bits.extend(&f_bits_lower); } - let bytes_len = if (B * N) % 8 == 0 { + let bytes_len = if (B * N).is_multiple_of(8) { (B * N) / 8 } else { ((B * N) / 8) + 1 @@ -108,7 +108,7 @@ impl ForeignElement { /// elements of type `F` in little-endian. Right now it is written /// so that it gives `N` (limb count) limbs, even if it fits in less bits. fn big_to_vec(fe: BigUint) -> Vec { - if B % 8 == 0 { + if B.is_multiple_of(8) { let bytes = fe.to_bytes_le(); let chunks: Vec<&[u8]> = bytes.chunks(B / 8).collect(); chunks diff --git a/utils/src/math.rs b/utils/src/math.rs index b7781fdccf4..7705fb4c346 100644 --- a/utils/src/math.rs +++ b/utils/src/math.rs @@ -19,5 +19,5 @@ pub fn ceil_log2(d: usize) -> usize { /// This function is bound to be stable soon. See pub fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b + a.div_ceil(b) }