Skip to content

Commit

Permalink
removing overkill clippy allows
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Jun 16, 2024
1 parent ba0dd1f commit d2c6c90
Show file tree
Hide file tree
Showing 32 changed files with 56 additions and 40 deletions.
16 changes: 8 additions & 8 deletions core/src/air/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub trait BaseAirBuilder: AirBuilder + MessageBuilder<AirInteraction<Self::Expr>
/// A trait which contains methods for byte interactions in an AIR.
pub trait ByteAirBuilder: BaseAirBuilder {
/// Sends a byte operation to be processed.
#[allow(clippy::too_many_arguments)]

fn send_byte(
&mut self,
opcode: impl Into<Self::Expr>,
Expand All @@ -107,7 +107,7 @@ pub trait ByteAirBuilder: BaseAirBuilder {
}

/// Sends a byte operation with two outputs to be processed.
#[allow(clippy::too_many_arguments)]

fn send_byte_pair(
&mut self,
opcode: impl Into<Self::Expr>,
Expand Down Expand Up @@ -135,7 +135,7 @@ pub trait ByteAirBuilder: BaseAirBuilder {
}

/// Receives a byte operation to be processed.
#[allow(clippy::too_many_arguments)]

fn receive_byte(
&mut self,
opcode: impl Into<Self::Expr>,
Expand All @@ -159,7 +159,7 @@ pub trait ByteAirBuilder: BaseAirBuilder {
}

/// Receives a byte operation with two outputs to be processed.
#[allow(clippy::too_many_arguments)]

fn receive_byte_pair(
&mut self,
opcode: impl Into<Self::Expr>,
Expand Down Expand Up @@ -298,7 +298,7 @@ pub trait WordAirBuilder: ByteAirBuilder {
/// A trait which contains methods related to ALU interactions in an AIR.
pub trait AluAirBuilder: BaseAirBuilder {
/// Sends an ALU operation to be processed.
#[allow(clippy::too_many_arguments)]

fn send_alu(
&mut self,
opcode: impl Into<Self::Expr>,
Expand All @@ -325,7 +325,7 @@ pub trait AluAirBuilder: BaseAirBuilder {
}

/// Receives an ALU operation to be processed.
#[allow(clippy::too_many_arguments)]

fn receive_alu(
&mut self,
opcode: impl Into<Self::Expr>,
Expand All @@ -352,7 +352,7 @@ pub trait AluAirBuilder: BaseAirBuilder {
}

/// Sends an syscall operation to be processed (with "ECALL" opcode).
#[allow(clippy::too_many_arguments)]

fn send_syscall(
&mut self,
shard: impl Into<Self::Expr> + Clone,
Expand All @@ -378,7 +378,7 @@ pub trait AluAirBuilder: BaseAirBuilder {
}

/// Receives a syscall operation to be processed.
#[allow(clippy::too_many_arguments)]

fn receive_syscall(
&mut self,
shard: impl Into<Self::Expr> + Clone,
Expand Down
4 changes: 2 additions & 2 deletions core/src/operations/add4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Add4Operation<T> {
}

impl<F: Field> Add4Operation<F> {
#[allow(clippy::too_many_arguments)]

pub fn populate(
&mut self,
record: &mut impl ByteRecord,
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<F: Field> Add4Operation<F> {
expected
}

#[allow(clippy::too_many_arguments)]

pub fn eval<AB: WordAirBuilder<F = F>>(
builder: &mut AB,
a: Word<AB::Var>,
Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/add5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct Add5Operation<T> {
}

impl<F: Field> Add5Operation<F> {
#[allow(clippy::too_many_arguments)]

pub fn populate(
&mut self,
record: &mut impl ByteRecord,
Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/field/field_den.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<F: PrimeField32, P: FieldParameters> FieldDenCols<F, P> {
}

impl<V: Copy, P: FieldParameters> FieldDenCols<V, P> {
#[allow(clippy::too_many_arguments)]

pub fn eval<AB: BaseAirBuilder<Var = V>>(
&self,
builder: &mut AB,
Expand Down
4 changes: 2 additions & 2 deletions core/src/operations/field/field_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<F: PrimeField32, P: FieldParameters> FieldOpCols<F, P> {

/// Populate these columns with a specified modulus. This is useful in the `mulmod` precompile
/// as an example.
#[allow(clippy::too_many_arguments)]

pub fn populate_with_modulus(
&mut self,
record: &mut impl ByteRecord,
Expand Down Expand Up @@ -243,7 +243,7 @@ impl<V: Copy, P: FieldParameters> FieldOpCols<V, P> {
builder.slice_range_check_u8(p_witness_high.coefficients(), shard, channel, is_real);
}

#[allow(clippy::too_many_arguments)]

pub fn eval<AB: BaseAirBuilder<Var = V>>(
&self,
builder: &mut AB,
Expand Down
2 changes: 2 additions & 0 deletions core/src/runtime/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub enum MemoryRecordEnum {
Write(MemoryWriteRecord),
}


#[allow(clippy::manual_non_exhaustive)]
#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)]
pub struct MemoryReadRecord {
Expand All @@ -40,6 +41,7 @@ pub struct MemoryReadRecord {
_private: (),
}


#[allow(clippy::manual_non_exhaustive)]
#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)]
pub struct MemoryWriteRecord {
Expand Down
2 changes: 1 addition & 1 deletion core/src/stark/permutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rayon_scan::ScanParallelIterator;
use crate::{air::MultiTableAirBuilder, lookup::Interaction};

#[inline]
#[allow(clippy::too_many_arguments)]

pub fn populate_permutation_row<F: PrimeField, EF: ExtensionField<F>>(
row: &mut [EF],
preprocessed_row: &[F],
Expand Down
2 changes: 1 addition & 1 deletion core/src/stark/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl<SC: StarkGenericConfig, A: MachineAir<Val<SC>>> Verifier<SC, A> {
Ok(())
}

#[allow(clippy::too_many_arguments)]

fn verify_constraints(
chip: &MachineChip<SC, A>,
opening: &ChipOpenedValues<SC::Challenge>,
Expand Down
4 changes: 2 additions & 2 deletions core/src/syscall/precompiles/bls12_381/g2_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,8 @@ mod tests {
let mut result = vec![];
// Fp / BigUint is encoded as a 12 u32 words. G2Affine point has 4 Fp elements, so we read 4 * 12 words from the memory
for i in 0..48 {
#[allow(clippy::clone_on_copy)]
result.push(memory.get(&(a_ptr + i * 4)).unwrap().clone().value);

result.push(memory.get(&(a_ptr + i * 4)).unwrap().value);
}

let computed_x_c0 = BigUint::new(result[0..12].to_vec());
Expand Down
4 changes: 2 additions & 2 deletions core/src/syscall/precompiles/bls12_381/g2_double.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ mod tests {
let mut result = vec![];
// Fp / BigUint is encoded as a 12 u32 words. G2Affine point has 4 Fp elements, so we read 4 * 12 words from the memory
for i in 0..48 {
#[allow(clippy::clone_on_copy)]
result.push(memory.get(&(p_ptr + i * 4)).unwrap().clone().value);

result.push(memory.get(&(p_ptr + i * 4)).unwrap().value);
}

let computed_x_c0 = BigUint::new(result[0..12].to_vec());
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/edwards/ed_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<E: EllipticCurve + EdwardsParameters> EdAddAssignChip<E> {
}
}

#[allow(clippy::too_many_arguments)]

fn populate_field_ops<F: PrimeField32>(
record: &mut impl ByteRecord,
shard: u32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<E: EllipticCurve> WeierstrassAddAssignChip<E> {
}
}

#[allow(clippy::too_many_arguments)]

fn populate_field_ops<F: PrimeField32>(
blu_events: &mut Vec<ByteLookupEvent>,
shard: u32,
Expand Down
2 changes: 2 additions & 0 deletions recursion/circuit/src/challenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl<C: Config> MultiField32ChallengerVariable<C> {
builder: &mut Builder<C>,
value: [Var<C::N>; DIGEST_SIZE],
) {
#[allow(clippy::needless_range_loop)]
for i in 0..DIGEST_SIZE {
let f_vals: Vec<Felt<C::F>> = split_32(builder, value[i], self.num_f_elms);
for f_val in f_vals {
Expand Down Expand Up @@ -167,6 +168,7 @@ mod tests {
let mut value_u32 = 1345237507;
let value = builder.eval(Bn254Fr::from_canonical_u32(value_u32));
let result = builder.num2bits_v_circuit(value, 32);
#[allow(clippy::needless_range_loop)]
for i in 0..result.len() {
builder.assert_var_eq(result[i], Bn254Fr::from_canonical_u32(value_u32 & 1));
value_u32 >>= 1;
Expand Down
2 changes: 1 addition & 1 deletion recursion/circuit/src/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod tests {

use crate::stark::{tests::basic_program, StarkVerifierCircuit};

#[allow(clippy::type_complexity)]

fn get_shard_data<'a, SC>(
machine: &'a StarkMachine<SC, RecursionAirWideDeg3<SC::Val>>,
proof: &'a ShardProof<SC>,
Expand Down
1 change: 1 addition & 0 deletions recursion/circuit/src/fri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ pub fn verify_query<C: Config>(
let mut x = builder.exp_e_bits(two_adic_generator, &rev_reduced_index[..]);

let mut offset = 0;
#[allow(clippy::explicit_counter_loop)]
for (log_folded_height, commit, step, beta) in izip!(
(0..log_max_height).rev(),
commit_phase_commits,
Expand Down
8 changes: 4 additions & 4 deletions recursion/circuit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::explicit_counter_loop)]




#![allow(type_alias_bounds)]

pub mod challenger;
Expand Down
1 change: 1 addition & 0 deletions recursion/circuit/src/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ where
prep_mats.push(prep_mat);
}

#[allow(clippy::needless_range_loop)]
for i in 0..num_shard_chips {
let opening = &opened_values.chips[i];
let log_quotient_degree = chip_quotient_data[i].log_quotient_degree;
Expand Down
3 changes: 2 additions & 1 deletion recursion/circuit/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub struct TwoAdicPcsRoundVariable<C: Config> {
pub mats: Vec<TwoAdicPcsMatsVariable<C>>,
}

#[allow(clippy::type_complexity)]

#[derive(Clone)]
pub struct TwoAdicPcsMatsVariable<C: Config> {
pub domain: TwoAdicMultiplicativeCoset<C::F>,
Expand Down Expand Up @@ -182,6 +182,7 @@ impl<C: Config> ChipOpening<C> {
for i in 0..num_quotient_chunks {
let chunk = &opening.quotient[i];
let mut quotient_vals = vec![];
#[allow(clippy::needless_range_loop)]
for j in 0..C::EF::D {
let value = &chunk[j];
quotient_vals.push(*value);
Expand Down
1 change: 1 addition & 0 deletions recursion/compiler/src/ir/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl<C: Config> Builder<C> {
/// Convert bits to a variable inside a circuit.
pub fn bits2num_v_circuit(&mut self, bits: &[Var<C::N>]) -> Var<C::N> {
let result: Var<_> = self.eval(C::N::zero());
#[allow(clippy::needless_range_loop)]
for i in 0..bits.len() {
self.assign(&result, result + bits[i] * C::N::from_canonical_u32(1 << i));
}
Expand Down
3 changes: 3 additions & 0 deletions recursion/compiler/src/ir/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl<C: Config> Builder<C> {
pub fn exp_f_bits(&mut self, x: Felt<C::F>, power_bits: &[Var<C::N>]) -> Felt<C::F> {
let mut result = self.eval(C::F::one());
let mut power_f: Felt<_> = self.eval(x);
#[allow(clippy::needless_range_loop)]
for i in 0..power_bits.len() {
let bit = power_bits[i];
let tmp = self.eval(result * power_f);
Expand All @@ -93,6 +94,7 @@ impl<C: Config> Builder<C> {
) -> Ext<C::F, C::EF> {
let mut result = self.eval(SymbolicExt::from_f(C::EF::one()));
let mut power_f: Ext<_, _> = self.eval(x);
#[allow(clippy::needless_range_loop)]
for i in 0..power_bits.len() {
let bit = power_bits[i];
let tmp = self.eval(result * power_f);
Expand Down Expand Up @@ -187,6 +189,7 @@ impl<C: Config> Builder<C> {
pub fn ext_from_base_slice(&mut self, arr: &[Felt<C::F>]) -> Ext<C::F, C::EF> {
assert!(arr.len() <= <C::EF as AbstractExtensionField::<C::F>>::D);
let mut res = SymbolicExt::from_f(C::EF::zero());
#[allow(clippy::needless_range_loop)]
for i in 0..arr.len() {
res += arr[i] * SymbolicExt::from_f(C::EF::monomial(i));
}
Expand Down
2 changes: 1 addition & 1 deletion recursion/compiler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::needless_range_loop)]


extern crate alloc;

Expand Down
2 changes: 1 addition & 1 deletion recursion/core/src/fri_fold/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::needless_range_loop)]


use crate::air::RecursionMemoryAirBuilder;
use crate::memory::{MemoryReadCols, MemoryReadSingleCols, MemoryReadWriteCols};
Expand Down
1 change: 1 addition & 0 deletions recursion/core/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use p3_field::PrimeField32;
use crate::air::Block;
pub use columns::*;


#[allow(clippy::manual_non_exhaustive)]
#[derive(Debug, Clone, Copy)]
pub struct MemoryRecord<F> {
Expand Down
3 changes: 2 additions & 1 deletion recursion/core/src/poseidon2/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<F: Field> Poseidon2Chip<F> {
}
}

#[allow(clippy::too_many_arguments)]

fn eval_computation<AB: BaseAirBuilder + ExtensionAirBuilder>(
&self,
builder: &mut AB,
Expand All @@ -172,6 +172,7 @@ impl<F: Field> Poseidon2Chip<F> {
// Internal Layers: Only apply the round constants to the first element.
for i in 0..WIDTH {
let mut result: AB::Expr = computation_cols.input[i].into();
#[allow(clippy::needless_range_loop)]
for r in 0..rounds {
if i == 0 {
result += local.rounds[r + 2]
Expand Down
2 changes: 1 addition & 1 deletion recursion/core/src/poseidon2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::needless_range_loop)]


use crate::poseidon2::external::WIDTH;
mod columns;
Expand Down
2 changes: 1 addition & 1 deletion recursion/core/src/poseidon2_wide/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) enum Poseidon2ColTypeMut<'a, T> {

impl<T> Poseidon2ColTypeMut<'_, T> {
/// Returns mutable references to the poseidon2 columns and optional the intermediate sbox columns.
#[allow(clippy::type_complexity)]

pub(crate) fn get_cols_mut(
&mut self,
) -> (
Expand Down
3 changes: 3 additions & 0 deletions recursion/core/src/poseidon2_wide/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl<F: PrimeField32, const DEGREE: usize> MachineAir<F> for Poseidon2WideChip<F
if r == NUM_EXTERNAL_ROUNDS - 1 {
// Do nothing, since we set the cols.output by populating the output records
// after this loop.
#[allow(clippy::needless_range_loop)]
for i in 0..WIDTH {
assert_eq!(event.result_records[i].value[0], next_state[i]);
}
Expand Down Expand Up @@ -175,6 +176,7 @@ fn populate_external_round<F: PrimeField32>(
r + NUM_INTERNAL_ROUNDS
};
let mut add_rc = *round_state;
#[allow(clippy::needless_range_loop)]
for i in 0..WIDTH {
add_rc[i] += F::from_wrapped_u32(RC_16_30_U32[round][i]);
}
Expand Down Expand Up @@ -208,6 +210,7 @@ fn populate_internal_rounds<F: PrimeField32>(
) -> [F; WIDTH] {
let mut state: [F; WIDTH] = poseidon2_cols.internal_rounds_state;
let mut sbox_deg_3: [F; NUM_INTERNAL_ROUNDS] = [F::zero(); NUM_INTERNAL_ROUNDS];
#[allow(clippy::needless_range_loop)]
for r in 0..NUM_INTERNAL_ROUNDS {
// Add the round constant to the 0th state element.
// Optimization: Since adding a constant is a degree 1 operation, we can avoid adding
Expand Down
2 changes: 1 addition & 1 deletion recursion/core/src/poseidon2_wide/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::needless_range_loop)]


use crate::poseidon2_wide::external::WIDTH;
use p3_baby_bear::{MONTY_INVERSE, POSEIDON2_INTERNAL_MATRIX_DIAG_16_BABYBEAR_MONTY};
Expand Down
2 changes: 1 addition & 1 deletion recursion/core/src/runtime/opcode.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use p3_field::AbstractField;
use serde::{Deserialize, Serialize};

#[allow(clippy::upper_case_acronyms)]

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Opcode {
// Arithmetic field instructions.
Expand Down
Loading

0 comments on commit d2c6c90

Please sign in to comment.