From 3423b03c6dd66b7f357cce90fe7691d0534af723 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Thu, 4 Feb 2021 07:26:35 -0700 Subject: [PATCH] Fix a couple more lints. --- zcash_primitives/src/group_hash.rs | 2 +- zcash_proofs/src/circuit/sprout/mod.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/zcash_primitives/src/group_hash.rs b/zcash_primitives/src/group_hash.rs index 6120a33c8..5a9f06a09 100644 --- a/zcash_primitives/src/group_hash.rs +++ b/zcash_primitives/src/group_hash.rs @@ -1,4 +1,3 @@ -#![allow(clippy::assertions_on_constants)] //! Implementation of [group hashing into Jubjub][grouphash]. //! //! [grouphash]: https://zips.z.cash/protocol/protocol.pdf#concretegrouphashjubjub @@ -12,6 +11,7 @@ use blake2s_simd::Params; /// Produces a random point in the Jubjub curve. /// The point is guaranteed to be prime order /// and not the identity. +#[allow(clippy::assertions_on_constants)] pub fn group_hash(tag: &[u8], personalization: &[u8]) -> Option { assert_eq!(personalization.len(), 8); diff --git a/zcash_proofs/src/circuit/sprout/mod.rs b/zcash_proofs/src/circuit/sprout/mod.rs index e86795524..97ad21db4 100644 --- a/zcash_proofs/src/circuit/sprout/mod.rs +++ b/zcash_proofs/src/circuit/sprout/mod.rs @@ -347,9 +347,8 @@ fn test_sprout_constraints() { fn get_u256(mut reader: R) -> [u8; 32] { let mut result = [0u8; 32]; - #[allow(clippy::needless_range_loop)] - for i in 0..32 { - result[i] = reader.read_u8().unwrap(); + for b in &mut result { + *b = reader.read_u8().unwrap(); } result @@ -375,9 +374,8 @@ fn test_sprout_constraints() { auth_path[i] = Some((sibling, false)); } let mut position = test_vector.read_u64::().unwrap(); - #[allow(clippy::needless_range_loop)] - for i in 0..TREE_DEPTH { - if let Some(p) = auth_path[i].as_mut() { + for sibling in &mut auth_path { + if let Some(p) = sibling { p.1 = (position & 1) == 1; }