Silence clippy needless_range_loop warnings

I'm using range loops explicitly to make certain logic clearer.
This commit is contained in:
Jack Grigg 2021-03-12 07:10:42 +13:00
parent 6bcfecd039
commit c578c22fe8
2 changed files with 3 additions and 0 deletions

View File

@ -147,6 +147,7 @@ fn permute<F: FieldExt, S: Spec<F>>(
let apply_mds = |state: &mut S::State| {
let mut new_state = S::State::default();
// Matrix multiplication
#[allow(clippy::needless_range_loop)]
for i in 0..S::arity() {
for j in 0..S::arity() {
new_state.as_mut()[i] += mds[i].as_ref()[j] * state.as_ref()[j];

View File

@ -50,6 +50,7 @@ pub(super) fn generate_mds<F: FieldExt>(
// and we want to rely on the reference impl for MDS security, so we use the same
// formulation.
let mut mds = vec![vec![F::zero(); arity]; arity];
#[allow(clippy::needless_range_loop)]
for i in 0..arity {
for j in 0..arity {
let sum = xs[i] + ys[j];
@ -109,6 +110,7 @@ mod tests {
let (mds, mds_inv) = generate_mds::<Fp>(&mut grain, arity, 0);
// Verify that MDS * MDS^-1 = I.
#[allow(clippy::needless_range_loop)]
for i in 0..arity {
for j in 0..arity {
let expected = if i == j { Fp::one() } else { Fp::zero() };