diff --git a/src/bin/generate_constants.rs b/src/bin/generate_constants.rs index 60028741..89630fc7 100644 --- a/src/bin/generate_constants.rs +++ b/src/bin/generate_constants.rs @@ -1,5 +1,7 @@ //! Generates random constants using ChaCha20, seeded with zero. +#![allow(clippy::needless_range_loop)] + use plonky2::field::field_types::PrimeField; use plonky2::field::goldilocks_field::GoldilocksField; use rand::{Rng, SeedableRng}; diff --git a/src/field/extension_field/target.rs b/src/field/extension_field/target.rs index 3f9b6684..97e926b4 100644 --- a/src/field/extension_field/target.rs +++ b/src/field/extension_field/target.rs @@ -35,6 +35,7 @@ impl ExtensionTarget { let arr = self.to_target_array(); let k = (F::order() - 1u32) / (D as u64); let z0 = F::Extension::W.exp_biguint(&(k * count as u64)); + #[allow(clippy::needless_collect)] let zs = z0 .powers() .take(D) diff --git a/src/field/fft.rs b/src/field/fft.rs index 17c29184..89b6844d 100644 --- a/src/field/fft.rs +++ b/src/field/fft.rs @@ -38,12 +38,12 @@ fn fft_dispatch( zero_factor: Option, root_table: Option<&FftRootTable>, ) -> Vec { - let computed_root_table = if let Some(_) = root_table { + let computed_root_table = if root_table.is_some() { None } else { Some(fft_root_table(input.len())) }; - let used_root_table = root_table.or(computed_root_table.as_ref()).unwrap(); + let used_root_table = root_table.or_else(|| computed_root_table.as_ref()).unwrap(); fft_classic(input, zero_factor.unwrap_or(0), used_root_table) } @@ -122,8 +122,8 @@ fn fft_classic_simd( // Set omega to root_table[lg_half_m][0..half_m] but repeated. let mut omega_vec = P::zero().to_vec(); - for j in 0..omega_vec.len() { - omega_vec[j] = root_table[lg_half_m][j % half_m]; + for (j, omega) in omega_vec.iter_mut().enumerate() { + *omega = root_table[lg_half_m][j % half_m]; } let omega = P::from_slice(&omega_vec[..]); @@ -201,9 +201,9 @@ pub(crate) fn fft_classic(input: &[F], r: usize, root_table: &FftRootT if lg_n <= lg_packed_width { // Need the slice to be at least the width of two packed vectors for the vectorized version // to work. Do this tiny problem in scalar. - fft_classic_simd::>(&mut values[..], r, lg_n, &root_table); + fft_classic_simd::>(&mut values[..], r, lg_n, root_table); } else { - fft_classic_simd::<::PackedType>(&mut values[..], r, lg_n, &root_table); + fft_classic_simd::<::PackedType>(&mut values[..], r, lg_n, root_table); } values } @@ -267,7 +267,7 @@ mod tests { let values = subgroup .into_iter() - .map(|x| evaluate_at_naive(&coefficients, x)) + .map(|x| evaluate_at_naive(coefficients, x)) .collect(); PolynomialValues::new(values) } @@ -276,8 +276,8 @@ mod tests { let mut sum = F::ZERO; let mut point_power = F::ONE; for &c in &coefficients.coeffs { - sum = sum + c * point_power; - point_power = point_power * point; + sum += c * point_power; + point_power *= point; } sum } diff --git a/src/field/field_testing.rs b/src/field/field_testing.rs index d15b712a..54718f4a 100644 --- a/src/field/field_testing.rs +++ b/src/field/field_testing.rs @@ -1,3 +1,4 @@ +#![allow(clippy::eq_op)] use crate::field::extension_field::Extendable; use crate::field::extension_field::Frobenius; use crate::field::field_types::Field; diff --git a/src/field/field_types.rs b/src/field/field_types.rs index 45839bd9..036793cc 100644 --- a/src/field/field_types.rs +++ b/src/field/field_types.rs @@ -335,7 +335,7 @@ pub trait Field: } fn kth_root_u64(&self, k: u64) -> Self { - let p = Self::order().clone(); + let p = Self::order(); let p_minus_1 = &p - 1u32; debug_assert!( Self::is_monomial_permutation_u64(k), @@ -422,6 +422,7 @@ pub trait PrimeField: Field { unsafe { self.sub_canonical_u64(1) } } + /// # Safety /// Equivalent to *self + Self::from_canonical_u64(rhs), but may be cheaper. The caller must /// ensure that 0 <= rhs < Self::ORDER. The function may return incorrect results if this /// precondition is not met. It is marked unsafe for this reason. @@ -431,6 +432,7 @@ pub trait PrimeField: Field { *self + Self::from_canonical_u64(rhs) } + /// # Safety /// Equivalent to *self - Self::from_canonical_u64(rhs), but may be cheaper. The caller must /// ensure that 0 <= rhs < Self::ORDER. The function may return incorrect results if this /// precondition is not met. It is marked unsafe for this reason. diff --git a/src/field/prime_field_testing.rs b/src/field/prime_field_testing.rs index 4febc3a8..9dae4896 100644 --- a/src/field/prime_field_testing.rs +++ b/src/field/prime_field_testing.rs @@ -24,7 +24,7 @@ where ExpectedOp: Fn(u64) -> u64, { let inputs = test_inputs(F::ORDER); - let expected: Vec<_> = inputs.iter().map(|x| expected_op(x.clone())).collect(); + let expected: Vec<_> = inputs.iter().map(|&x| expected_op(x)).collect(); let output: Vec<_> = inputs .iter() .cloned() diff --git a/src/fri/commitment.rs b/src/fri/commitment.rs index c8a13cac..ee2e66eb 100644 --- a/src/fri/commitment.rs +++ b/src/fri/commitment.rs @@ -216,7 +216,7 @@ impl PolynomialBatchCommitment { lde_final_poly, lde_final_values, challenger, - &common_data, + common_data, timing, ); diff --git a/src/fri/recursive_verifier.rs b/src/fri/recursive_verifier.rs index b31e01a8..91d0580a 100644 --- a/src/fri/recursive_verifier.rs +++ b/src/fri/recursive_verifier.rs @@ -407,7 +407,7 @@ impl, const D: usize> CircuitBuilder { arity_bits, evals, betas[i], - &common_data + common_data ) ); diff --git a/src/gadgets/biguint.rs b/src/gadgets/biguint.rs index fff97a6e..fa5aa0b6 100644 --- a/src/gadgets/biguint.rs +++ b/src/gadgets/biguint.rs @@ -142,9 +142,9 @@ impl, const D: usize> CircuitBuilder { let mut combined_limbs = vec![]; let mut carry = self.zero_u32(); - for i in 0..total_limbs { - to_add[i].push(carry); - let (new_result, new_carry) = self.add_many_u32(&to_add[i].clone()); + for summands in &mut to_add { + summands.push(carry); + let (new_result, new_carry) = self.add_many_u32(summands); combined_limbs.push(new_result); carry = new_carry; } @@ -172,9 +172,9 @@ impl, const D: usize> CircuitBuilder { _phantom: PhantomData, }); - let div_b = self.mul_biguint(&div, &b); + let div_b = self.mul_biguint(&div, b); let div_b_plus_rem = self.add_biguint(&div_b, &rem); - self.connect_biguint(&a, &div_b_plus_rem); + self.connect_biguint(a, &div_b_plus_rem); let cmp_rem_b = self.cmp_biguint(&rem, b); self.assert_one(cmp_rem_b.target); diff --git a/src/gadgets/permutation.rs b/src/gadgets/permutation.rs index 37169514..2d8c4f22 100644 --- a/src/gadgets/permutation.rs +++ b/src/gadgets/permutation.rs @@ -378,7 +378,7 @@ mod tests { let pw = PartialWitness::new(); let mut builder = CircuitBuilder::::new(config); - let lst: Vec = (0..size * 2).map(|n| F::from_canonical_usize(n)).collect(); + let lst: Vec = (0..size * 2).map(F::from_canonical_usize).collect(); let a: Vec> = lst[..] .chunks(2) .map(|pair| vec![builder.constant(pair[0]), builder.constant(pair[1])]) diff --git a/src/gadgets/sorting.rs b/src/gadgets/sorting.rs index 2c52db23..2059a888 100644 --- a/src/gadgets/sorting.rs +++ b/src/gadgets/sorting.rs @@ -224,7 +224,7 @@ mod tests { izip!(is_write_vals, address_vals, timestamp_vals, value_vals) .zip(combined_vals_u64) .collect::>(); - input_ops_and_keys.sort_by_key(|(_, val)| val.clone()); + input_ops_and_keys.sort_by_key(|(_, val)| *val); let input_ops_sorted: Vec<_> = input_ops_and_keys.iter().map(|(x, _)| x).collect(); let output_ops = diff --git a/src/gates/arithmetic_u32.rs b/src/gates/arithmetic_u32.rs index 2bbbda6e..a5a63047 100644 --- a/src/gates/arithmetic_u32.rs +++ b/src/gates/arithmetic_u32.rs @@ -261,17 +261,11 @@ impl, const D: usize> SimpleGenerator fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let mut deps = Vec::with_capacity(3); - deps.push(local_target( - U32ArithmeticGate::::wire_ith_multiplicand_0(self.i), - )); - deps.push(local_target( - U32ArithmeticGate::::wire_ith_multiplicand_1(self.i), - )); - deps.push(local_target(U32ArithmeticGate::::wire_ith_addend( - self.i, - ))); - deps + vec![ + local_target(U32ArithmeticGate::::wire_ith_multiplicand_0(self.i)), + local_target(U32ArithmeticGate::::wire_ith_multiplicand_1(self.i)), + local_target(U32ArithmeticGate::::wire_ith_addend(self.i)), + ] } fn run_once(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues) { @@ -307,23 +301,19 @@ impl, const D: usize> SimpleGenerator let num_limbs = U32ArithmeticGate::::num_limbs(); let limb_base = 1 << U32ArithmeticGate::::limb_bits(); - let output_limbs_u64: Vec<_> = unfold((), move |_| { + let output_limbs_u64 = unfold((), move |_| { let ret = output_u64 % limb_base; output_u64 /= limb_base; Some(ret) }) - .take(num_limbs) - .collect(); - let output_limbs_f: Vec<_> = output_limbs_u64 - .into_iter() - .map(F::from_canonical_u64) - .collect(); + .take(num_limbs); + let output_limbs_f = output_limbs_u64.map(F::from_canonical_u64); - for j in 0..num_limbs { + for (j, output_limb) in output_limbs_f.enumerate() { let wire = local_wire(U32ArithmeticGate::::wire_ith_output_jth_limb( self.i, j, )); - out_buffer.set_wire(wire, output_limbs_f[j]); + out_buffer.set_wire(wire, output_limb); } } } diff --git a/src/gates/assert_le.rs b/src/gates/assert_le.rs index ffbc043a..4da3c44b 100644 --- a/src/gates/assert_le.rs +++ b/src/gates/assert_le.rs @@ -340,10 +340,10 @@ impl, const D: usize> SimpleGenerator fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let mut deps = Vec::new(); - deps.push(local_target(self.gate.wire_first_input())); - deps.push(local_target(self.gate.wire_second_input())); - deps + vec![ + local_target(self.gate.wire_first_input()), + local_target(self.gate.wire_second_input()), + ] } fn run_once(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues) { @@ -555,7 +555,7 @@ mod tests { }; let mut rng = rand::thread_rng(); - let max: u64 = 1 << num_bits - 1; + let max: u64 = 1 << (num_bits - 1); let first_input_u64 = rng.gen_range(0..max); let second_input_u64 = { let mut val = rng.gen_range(0..max); diff --git a/src/gates/comparison.rs b/src/gates/comparison.rs index a610c5e2..614a759e 100644 --- a/src/gates/comparison.rs +++ b/src/gates/comparison.rs @@ -151,10 +151,8 @@ impl, const D: usize> Gate for ComparisonGate .collect(); // Range-check the bits. - for i in 0..most_significant_diff_bits.len() { - constraints.push( - most_significant_diff_bits[i] * (F::Extension::ONE - most_significant_diff_bits[i]), - ); + for &bit in &most_significant_diff_bits { + constraints.push(bit * (F::Extension::ONE - bit)); } let bits_combined = reduce_with_powers(&most_significant_diff_bits, F::Extension::TWO); @@ -232,9 +230,8 @@ impl, const D: usize> Gate for ComparisonGate .collect(); // Range-check the bits. - for i in 0..most_significant_diff_bits.len() { - constraints - .push(most_significant_diff_bits[i] * (F::ONE - most_significant_diff_bits[i])); + for &bit in &most_significant_diff_bits { + constraints.push(bit * (F::ONE - bit)); } let bits_combined = reduce_with_powers(&most_significant_diff_bits, F::TWO); @@ -324,8 +321,7 @@ impl, const D: usize> Gate for ComparisonGate .collect(); // Range-check the bits. - for i in 0..most_significant_diff_bits.len() { - let this_bit = most_significant_diff_bits[i]; + for &this_bit in &most_significant_diff_bits { let inverse = builder.sub_extension(one, this_bit); constraints.push(builder.mul_extension(this_bit, inverse)); } @@ -388,10 +384,10 @@ impl, const D: usize> SimpleGenerator fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let mut deps = Vec::new(); - deps.push(local_target(self.gate.wire_first_input())); - deps.push(local_target(self.gate.wire_second_input())); - deps + vec![ + local_target(self.gate.wire_first_input()), + local_target(self.gate.wire_second_input()), + ] } fn run_once(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues) { @@ -638,7 +634,7 @@ mod tests { }; let mut rng = rand::thread_rng(); - let max: u64 = 1 << num_bits - 1; + let max: u64 = 1 << (num_bits - 1); let first_input_u64 = rng.gen_range(0..max); let second_input_u64 = { let mut val = rng.gen_range(0..max); diff --git a/src/gates/exponentiation.rs b/src/gates/exponentiation.rs index 5087cebd..47e6cce5 100644 --- a/src/gates/exponentiation.rs +++ b/src/gates/exponentiation.rs @@ -335,9 +335,8 @@ mod tests { .map(|b| F::from_canonical_u64(*b)) .collect(); - let mut v = Vec::new(); - v.push(base); - v.extend(power_bits_f.clone()); + let mut v = vec![base]; + v.extend(power_bits_f); let mut intermediate_values = Vec::new(); let mut current_intermediate_value = F::ONE; diff --git a/src/gates/insertion.rs b/src/gates/insertion.rs index c55f53a9..3d2c1aa3 100644 --- a/src/gates/insertion.rs +++ b/src/gates/insertion.rs @@ -251,8 +251,7 @@ impl, const D: usize> SimpleGenerator for Insert let local_targets = |inputs: Range| inputs.map(local_target); - let mut deps = Vec::new(); - deps.push(local_target(self.gate.wires_insertion_index())); + let mut deps = vec![local_target(self.gate.wires_insertion_index())]; deps.extend(local_targets(self.gate.wires_element_to_insert())); for i in 0..self.gate.vec_size { deps.extend(local_targets(self.gate.wires_original_list_item(i))); @@ -291,7 +290,7 @@ impl, const D: usize> SimpleGenerator for Insert vec_size ); - let mut new_vec = orig_vec.clone(); + let mut new_vec = orig_vec; new_vec.insert(insertion_index, to_insert); let mut equality_dummy_vals = Vec::new(); @@ -372,14 +371,13 @@ mod tests { fn get_wires(orig_vec: Vec, insertion_index: usize, element_to_insert: FF) -> Vec { let vec_size = orig_vec.len(); - let mut v = Vec::new(); - v.push(F::from_canonical_usize(insertion_index)); + let mut v = vec![F::from_canonical_usize(insertion_index)]; v.extend(element_to_insert.0); for j in 0..vec_size { v.extend(orig_vec[j].0); } - let mut new_vec = orig_vec.clone(); + let mut new_vec = orig_vec; new_vec.insert(insertion_index, element_to_insert); let mut equality_dummy_vals = Vec::new(); for i in 0..=vec_size { diff --git a/src/gates/interpolation.rs b/src/gates/interpolation.rs index 0225ce59..3ebf7259 100644 --- a/src/gates/interpolation.rs +++ b/src/gates/interpolation.rs @@ -72,7 +72,7 @@ impl, const D: usize> HighDegreeInterpolationGate>::partial_first_constant_layer(&mut state); - state = >::mds_partial_layer_init(&mut state); + state = >::mds_partial_layer_init(&state); for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) { let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)]; constraints.push(state[0] - sbox_in); @@ -243,7 +243,7 @@ where // Partial rounds. >::partial_first_constant_layer(&mut state); - state = >::mds_partial_layer_init(&mut state); + state = >::mds_partial_layer_init(&state); for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) { let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)]; constraints.push(state[0] - sbox_in); @@ -345,7 +345,7 @@ where } } else { >::partial_first_constant_layer_recursive(builder, &mut state); - state = >::mds_partial_layer_init_recursive(builder, &mut state); + state = >::mds_partial_layer_init_recursive(builder, &state); for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) { let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)]; constraints.push(builder.sub_extension(state[0], sbox_in)); @@ -489,7 +489,7 @@ where } >::partial_first_constant_layer(&mut state); - state = >::mds_partial_layer_init(&mut state); + state = >::mds_partial_layer_init(&state); for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) { out_buffer.set_wire( local_wire(PoseidonGate::::wire_partial_sbox(r)), diff --git a/src/gates/random_access.rs b/src/gates/random_access.rs index cea4b079..2796cd01 100644 --- a/src/gates/random_access.rs +++ b/src/gates/random_access.rs @@ -263,8 +263,7 @@ impl, const D: usize> SimpleGenerator fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let mut deps = Vec::new(); - deps.push(local_target(self.gate.wire_access_index(self.copy))); + let mut deps = vec![local_target(self.gate.wire_access_index(self.copy))]; for i in 0..self.gate.vec_size() { deps.push(local_target(self.gate.wire_list_item(i, self.copy))); } diff --git a/src/gates/subtraction_u32.rs b/src/gates/subtraction_u32.rs index 225c09e4..26f6302e 100644 --- a/src/gates/subtraction_u32.rs +++ b/src/gates/subtraction_u32.rs @@ -244,17 +244,11 @@ impl, const D: usize> SimpleGenerator fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let mut deps = Vec::with_capacity(3); - deps.push(local_target(U32SubtractionGate::::wire_ith_input_x( - self.i, - ))); - deps.push(local_target(U32SubtractionGate::::wire_ith_input_y( - self.i, - ))); - deps.push(local_target( - U32SubtractionGate::::wire_ith_input_borrow(self.i), - )); - deps + vec![ + local_target(U32SubtractionGate::::wire_ith_input_x(self.i)), + local_target(U32SubtractionGate::::wire_ith_input_y(self.i)), + local_target(U32SubtractionGate::::wire_ith_input_borrow(self.i)), + ] } fn run_once(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues) { diff --git a/src/hash/arch/aarch64/poseidon_goldilocks_neon.rs b/src/hash/arch/aarch64/poseidon_goldilocks_neon.rs index 5d9d9fba..0aaa13a6 100644 --- a/src/hash/arch/aarch64/poseidon_goldilocks_neon.rs +++ b/src/hash/arch/aarch64/poseidon_goldilocks_neon.rs @@ -1,3 +1,5 @@ +#![allow(clippy::assertions_on_constants)] + use std::arch::aarch64::*; use static_assertions::const_assert; @@ -171,9 +173,7 @@ unsafe fn multiply(x: u64, y: u64) -> u64 { let xy_hi_lo_mul_epsilon = mul_epsilon(xy_hi); // add_with_wraparound is safe, as xy_hi_lo_mul_epsilon <= 0xfffffffe00000001 <= ORDER. - let res1 = add_with_wraparound(res0, xy_hi_lo_mul_epsilon); - - res1 + add_with_wraparound(res0, xy_hi_lo_mul_epsilon) } // ==================================== STANDALONE CONST LAYER ===================================== @@ -266,9 +266,7 @@ unsafe fn mds_reduce( // Multiply by EPSILON and accumulate. let res_unadj = vmlal_laneq_u32::<0>(res_lo, res_hi_hi, mds_consts0); let res_adj = vcgtq_u64(res_lo, res_unadj); - let res = vsraq_n_u64::<32>(res_unadj, res_adj); - - res + vsraq_n_u64::<32>(res_unadj, res_adj) } #[inline(always)] @@ -968,8 +966,7 @@ unsafe fn partial_round( #[inline(always)] unsafe fn full_round(state: [u64; 12], round_constants: &[u64; WIDTH]) -> [u64; 12] { let state = sbox_layer_full(state); - let state = mds_const_layers_full(state, round_constants); - state + mds_const_layers_full(state, round_constants) } #[inline] diff --git a/src/hash/hashing.rs b/src/hash/hashing.rs index a4610495..4fd537f1 100644 --- a/src/hash/hashing.rs +++ b/src/hash/hashing.rs @@ -110,9 +110,7 @@ pub fn hash_n_to_m(mut inputs: Vec, num_outputs: usize, pad: bo // Absorb all input chunks. for input_chunk in inputs.chunks(SPONGE_RATE) { - for i in 0..input_chunk.len() { - state[i] = input_chunk[i]; - } + state[..input_chunk.len()].copy_from_slice(input_chunk); state = permute(state); } diff --git a/src/iop/target.rs b/src/iop/target.rs index 8d4cbcfb..de3e4911 100644 --- a/src/iop/target.rs +++ b/src/iop/target.rs @@ -41,6 +41,7 @@ impl Target { /// A `Target` which has already been constrained such that it can only be 0 or 1. #[derive(Copy, Clone, Debug)] +#[allow(clippy::manual_non_exhaustive)] pub struct BoolTarget { pub target: Target, /// This private field is here to force all instantiations to go through `new_unsafe`. diff --git a/src/lib.rs b/src/lib.rs index 46db2cf5..331ee558 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,10 @@ #![allow(incomplete_features)] #![allow(const_evaluatable_unchecked)] +#![allow(clippy::new_without_default)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::len_without_is_empty)] +#![allow(clippy::module_inception)] +#![allow(clippy::needless_range_loop)] #![feature(asm)] #![feature(asm_sym)] #![feature(destructuring_assignment)] diff --git a/src/plonk/circuit_builder.rs b/src/plonk/circuit_builder.rs index 730699b9..01462611 100644 --- a/src/plonk/circuit_builder.rs +++ b/src/plonk/circuit_builder.rs @@ -634,7 +634,7 @@ impl, const D: usize> CircuitBuilder { // Precompute FFT roots. let max_fft_points = - 1 << degree_bits + max(self.config.rate_bits, log2_ceil(quotient_degree_factor)); + 1 << (degree_bits + max(self.config.rate_bits, log2_ceil(quotient_degree_factor))); let fft_root_table = fft_root_table(max_fft_points); let constants_sigmas_vecs = [constant_vecs, sigma_vecs.clone()].concat(); @@ -669,7 +669,7 @@ impl, const D: usize> CircuitBuilder { let watch_rep_index = forest.parents[watch_index]; generator_indices_by_watches .entry(watch_rep_index) - .or_insert(vec![]) + .or_insert_with(Vec::new) .push(i); } } diff --git a/src/plonk/proof.rs b/src/plonk/proof.rs index 70e38588..94bc4714 100644 --- a/src/plonk/proof.rs +++ b/src/plonk/proof.rs @@ -138,11 +138,7 @@ impl, const D: usize> CompressedProof { plonk_zs_partial_products_cap, quotient_polys_cap, openings, - opening_proof: opening_proof.decompress( - &challenges, - fri_inferred_elements, - common_data, - ), + opening_proof: opening_proof.decompress(challenges, fri_inferred_elements, common_data), } } } diff --git a/src/plonk/recursive_verifier.rs b/src/plonk/recursive_verifier.rs index 98c866f8..46ca5e6a 100644 --- a/src/plonk/recursive_verifier.rs +++ b/src/plonk/recursive_verifier.rs @@ -527,7 +527,7 @@ mod tests { &inner_vd.constants_sigmas_cap, ); - builder.add_recursive_verifier(pt, &inner_config, &inner_data, &inner_cd); + builder.add_recursive_verifier(pt, inner_config, &inner_data, &inner_cd); if print_gate_counts { builder.print_gate_counts(0); @@ -563,12 +563,12 @@ mod tests { ) -> Result<()> { let proof_bytes = proof.to_bytes()?; info!("Proof length: {} bytes", proof_bytes.len()); - let proof_from_bytes = ProofWithPublicInputs::from_bytes(proof_bytes, &cd)?; + let proof_from_bytes = ProofWithPublicInputs::from_bytes(proof_bytes, cd)?; assert_eq!(proof, &proof_from_bytes); let now = std::time::Instant::now(); - let compressed_proof = proof.clone().compress(&cd)?; - let decompressed_compressed_proof = compressed_proof.clone().decompress(&cd)?; + let compressed_proof = proof.clone().compress(cd)?; + let decompressed_compressed_proof = compressed_proof.clone().decompress(cd)?; info!("{:.4}s to compress proof", now.elapsed().as_secs_f64()); assert_eq!(proof, &decompressed_compressed_proof); @@ -578,7 +578,7 @@ mod tests { compressed_proof_bytes.len() ); let compressed_proof_from_bytes = - CompressedProofWithPublicInputs::from_bytes(compressed_proof_bytes, &cd)?; + CompressedProofWithPublicInputs::from_bytes(compressed_proof_bytes, cd)?; assert_eq!(compressed_proof, compressed_proof_from_bytes); Ok(()) diff --git a/src/polynomial/polynomial.rs b/src/polynomial/polynomial.rs index b5a7fabd..43e17823 100644 --- a/src/polynomial/polynomial.rs +++ b/src/polynomial/polynomial.rs @@ -441,7 +441,7 @@ mod tests { assert_eq!(coset_evals, naive_coset_evals); let ifft_coeffs = PolynomialValues::new(coset_evals).coset_ifft(shift); - assert_eq!(poly, ifft_coeffs.into()); + assert_eq!(poly, ifft_coeffs); } #[test] diff --git a/src/util/partial_products.rs b/src/util/partial_products.rs index 0f3c9bfa..b5e805e9 100644 --- a/src/util/partial_products.rs +++ b/src/util/partial_products.rs @@ -13,7 +13,7 @@ pub(crate) fn quotient_chunk_products( max_degree: usize, ) -> Vec { debug_assert!(max_degree > 1); - assert!(quotient_values.len() > 0); + assert!(!quotient_values.is_empty()); let chunk_size = max_degree; quotient_values .chunks(chunk_size) @@ -24,7 +24,7 @@ pub(crate) fn quotient_chunk_products( /// Compute partial products of the original vector `v` such that all products consist of `max_degree` /// or less elements. This is done until we've computed the product `P` of all elements in the vector. pub(crate) fn partial_products_and_z_gx(z_x: F, quotient_chunk_products: &[F]) -> Vec { - assert!(quotient_chunk_products.len() > 0); + assert!(!quotient_chunk_products.is_empty()); let mut res = Vec::new(); let mut acc = z_x; for "ient_chunk_product in quotient_chunk_products { diff --git a/src/util/timing.rs b/src/util/timing.rs index cd9ea731..4250d688 100644 --- a/src/util/timing.rs +++ b/src/util/timing.rs @@ -92,7 +92,7 @@ impl TimingTree { fn duration(&self) -> Duration { self.exit_time - .unwrap_or(Instant::now()) + .unwrap_or_else(Instant::now) .duration_since(self.enter_time) }