diff --git a/acvm-repo/acvm/src/compiler/transformers/csat.rs b/acvm-repo/acvm/src/compiler/transformers/csat.rs index 8976778547c..9f89ac4671a 100644 --- a/acvm-repo/acvm/src/compiler/transformers/csat.rs +++ b/acvm-repo/acvm/src/compiler/transformers/csat.rs @@ -235,8 +235,8 @@ impl CSatTransformer { opcode.mul_terms = remaining_mul_terms; // Add the rest of the elements back into the new_opcode - new_opcode.mul_terms.extend(opcode.mul_terms.clone()); - new_opcode.linear_combinations.extend(opcode.linear_combinations.clone()); + new_opcode.mul_terms.extend(opcode.mul_terms); + new_opcode.linear_combinations.extend(opcode.linear_combinations); new_opcode.q_c = opcode.q_c; new_opcode.sort(); new_opcode @@ -332,7 +332,7 @@ impl CSatTransformer { // 2. Create Intermediate variables for the multiplication opcodes let mut remaining_mul_terms = Vec::with_capacity(opcode.mul_terms.len()); - for mul_term in opcode.mul_terms.clone().into_iter() { + for mul_term in opcode.mul_terms { if self.solvable_witness.contains(&mul_term.1) && self.solvable_witness.contains(&mul_term.2) { diff --git a/acvm-repo/acvm/src/compiler/transformers/fallback.rs b/acvm-repo/acvm/src/compiler/transformers/fallback.rs index e96fa7283bd..d3e4ea506f8 100644 --- a/acvm-repo/acvm/src/compiler/transformers/fallback.rs +++ b/acvm-repo/acvm/src/compiler/transformers/fallback.rs @@ -106,12 +106,8 @@ impl FallbackTransformer { } #[cfg(feature = "unstable-fallbacks")] BlackBoxFuncCall::SHA256 { inputs, outputs } => { - let mut sha256_inputs = Vec::new(); - for input in inputs.iter() { - let witness_index = Expression::from(input.witness); - let num_bits = input.num_bits; - sha256_inputs.push((witness_index, num_bits)); - } + let sha256_inputs = + inputs.iter().map(|input| (input.witness.into(), input.num_bits)).collect(); stdlib::blackbox_fallbacks::sha256( sha256_inputs, outputs.to_vec(), @@ -120,42 +116,30 @@ impl FallbackTransformer { } #[cfg(feature = "unstable-fallbacks")] BlackBoxFuncCall::Blake2s { inputs, outputs } => { - let mut blake2s_input = Vec::new(); - for input in inputs.iter() { - let witness_index = Expression::from(input.witness); - let num_bits = input.num_bits; - blake2s_input.push((witness_index, num_bits)); - } + let blake2s_inputs = + inputs.iter().map(|input| (input.witness.into(), input.num_bits)).collect(); stdlib::blackbox_fallbacks::blake2s( - blake2s_input, + blake2s_inputs, outputs.to_vec(), current_witness_idx, ) } #[cfg(feature = "unstable-fallbacks")] BlackBoxFuncCall::HashToField128Security { inputs, output } => { - let mut blake2s_input = Vec::new(); - for input in inputs.iter() { - let witness_index = Expression::from(input.witness); - let num_bits = input.num_bits; - blake2s_input.push((witness_index, num_bits)); - } + let hash_to_field_inputs = + inputs.iter().map(|input| (input.witness.into(), input.num_bits)).collect(); stdlib::blackbox_fallbacks::hash_to_field( - blake2s_input, + hash_to_field_inputs, *output, current_witness_idx, ) } #[cfg(feature = "unstable-fallbacks")] BlackBoxFuncCall::Keccak256 { inputs, outputs } => { - let mut keccak_input = Vec::new(); - for input in inputs.iter() { - let witness_index = Expression::from(input.witness); - let num_bits = input.num_bits; - keccak_input.push((witness_index, num_bits)); - } + let keccak_inputs = + inputs.iter().map(|input| (input.witness.into(), input.num_bits)).collect(); stdlib::blackbox_fallbacks::keccak256( - keccak_input, + keccak_inputs, outputs.to_vec(), current_witness_idx, )