mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-12 17:01:30 +01:00
Remove a few unnecessary .into_iter() explicit calls, and some cloning.
See https://rust-lang.github.io/rust-clippy/master/#explicit_into_iter_loop
This commit is contained in:
committed by
Pratyush Mishra
parent
581f3df55f
commit
10c6e85c1a
@@ -32,7 +32,7 @@ impl<ConstraintF: PrimeField> CommitmentGadget<Blake2sCommitment, ConstraintF>
|
||||
r: &Self::RandomnessGadget,
|
||||
) -> Result<Self::OutputGadget, SynthesisError> {
|
||||
let mut input_bits = Vec::with_capacity(512);
|
||||
for byte in input.into_iter().chain(r.0.iter()) {
|
||||
for byte in input.iter().chain(r.0.iter()) {
|
||||
input_bits.extend_from_slice(&byte.into_bits_le());
|
||||
}
|
||||
let mut result = Vec::new();
|
||||
@@ -141,13 +141,13 @@ mod test {
|
||||
let primitive_result = Blake2sCommitment::commit(¶meters, &input, &randomness).unwrap();
|
||||
|
||||
let mut input_bytes = vec![];
|
||||
for (byte_i, input_byte) in input.into_iter().enumerate() {
|
||||
for (byte_i, input_byte) in input.iter().enumerate() {
|
||||
let cs = cs.ns(|| format!("input_byte_gadget_{}", byte_i));
|
||||
input_bytes.push(UInt8::alloc(cs, || Ok(*input_byte)).unwrap());
|
||||
}
|
||||
|
||||
let mut randomness_bytes = vec![];
|
||||
for (byte_i, random_byte) in randomness.into_iter().enumerate() {
|
||||
for (byte_i, random_byte) in randomness.iter().enumerate() {
|
||||
let cs = cs.ns(|| format!("randomness_byte_gadget_{}", byte_i));
|
||||
randomness_bytes.push(UInt8::alloc(cs, || Ok(*random_byte)).unwrap());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user