Skip to content

Commit b2c75d3

Browse files
committed
clippy
1 parent f77f55c commit b2c75d3

File tree

10 files changed

+32
-27
lines changed

10 files changed

+32
-27
lines changed

crates/air/src/verify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use p3_util::log2_ceil_usize;
44

55
use crate::utils::next_mle;
66

7+
#[allow(clippy::type_complexity)]
8+
#[allow(clippy::too_many_arguments)]
79
pub fn verify_air<EF: ExtensionField<PF<EF>>, A: Air>(
810
verifier_state: &mut FSVerifier<EF, impl FSChallenger<EF>>,
911
air: &A,
@@ -105,6 +107,7 @@ where
105107
}
106108

107109
#[allow(clippy::too_many_arguments)] // TODO
110+
#[allow(clippy::type_complexity)]
108111
fn open_columns<EF: ExtensionField<PF<EF>>>(
109112
verifier_state: &mut FSVerifier<EF, impl FSChallenger<EF>>,
110113
n_columns_f: usize,

crates/lean_compiler/src/parser/parsers/function.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ impl FunctionCallParser {
235235
}
236236
_ => {
237237
// Check for special precompile functions
238-
if let Some(table) = ALL_TABLES.into_iter().find(|p| p.name() == function_name) {
239-
if table != Table::execution() {
240-
return Ok(Line::Precompile { table, args });
241-
}
238+
if let Some(table) = ALL_TABLES.into_iter().find(|p| p.name() == function_name)
239+
&& table != Table::execution()
240+
{
241+
return Ok(Line::Precompile { table, args });
242242
}
243243

244244
// fall back to regular function call

crates/lean_prover/src/prove_execution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ fn prove_bus_and_air(
538538
.chunks_exact(1 << UNIVARIATE_SKIPS)
539539
.map(|chunk| {
540540
evaluate_univariate_multilinear::<_, _, _, false>(
541-
&chunk,
541+
chunk,
542542
&[epsilon],
543543
&uni_selectors,
544544
None,
@@ -549,7 +549,7 @@ fn prove_bus_and_air(
549549
.chunks_exact(1 << UNIVARIATE_SKIPS)
550550
.map(|chunk| {
551551
evaluate_univariate_multilinear::<_, _, _, false>(
552-
&chunk,
552+
chunk,
553553
&[epsilon],
554554
&uni_selectors,
555555
None,
@@ -585,7 +585,7 @@ fn prove_bus_and_air(
585585

586586
let extra_data = ExtraDataForBuses {
587587
fingerprint_challenge_powers: powers_const(fingerprint_challenge),
588-
bus_beta: bus_beta,
588+
bus_beta,
589589
alpha_powers: vec![], // filled later
590590
};
591591
let (air_point, evals_f, evals_ef) =

crates/lean_prover/src/verify_execution.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ pub fn verify_execution(
264264
final_pc_statement,
265265
]);
266266

267-
let mut all_base_statements = vec![
267+
let mut all_base_statements = [
268268
vec![memory_statements],
269269
encapsulate_vec(p16_gkr.cubes_statements.split()),
270270
encapsulate_vec(p24_gkr.cubes_statements.split()),
@@ -302,6 +302,7 @@ pub fn verify_execution(
302302
Ok(())
303303
}
304304

305+
#[allow(clippy::type_complexity)]
305306
fn verify_bus_and_air(
306307
verifier_state: &mut VerifierState<PF<EF>, EF, impl FSChallenger<EF>>,
307308
t: &Table,
@@ -363,7 +364,7 @@ fn verify_bus_and_air(
363364
.chunks_exact(1 << UNIVARIATE_SKIPS)
364365
.map(|chunk| {
365366
evaluate_univariate_multilinear::<_, _, _, false>(
366-
&chunk,
367+
chunk,
367368
&[epsilon],
368369
&uni_selectors,
369370
None,
@@ -374,7 +375,7 @@ fn verify_bus_and_air(
374375
.chunks_exact(1 << UNIVARIATE_SKIPS)
375376
.map(|chunk| {
376377
evaluate_univariate_multilinear::<_, _, _, false>(
377-
&chunk,
378+
chunk,
378379
&[epsilon],
379380
&uni_selectors,
380381
None,

crates/lean_prover/witness_generation/src/poseidon_tables.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ where
2121
let n_poseidons = inputs[0].len();
2222
assert!(n_poseidons.is_power_of_two());
2323
let inputs_packed: [_; WIDTH] =
24-
array::from_fn(|i| PFPacking::<F>::pack_slice(&inputs[i]).to_vec()); // TODO avoid cloning
24+
array::from_fn(|i| PFPacking::<F>::pack_slice(inputs[i]).to_vec()); // TODO avoid cloning
2525
generate_poseidon_witness::<FPacking<F>, WIDTH, N_COMMITED_CUBES>(
2626
inputs_packed,
2727
layers,

crates/lean_vm/src/tables/poseidon_16/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ impl TableT for Poseidon16Precompile {
169169
trace.base[POSEIDON_16_COL_INDEX_RES].push(index_res_a);
170170
trace.base[POSEIDON_16_COL_INDEX_RES_BIS].push(index_res_b);
171171
trace.base[POSEIDON_16_COL_COMPRESSION].push(F::from_bool(is_compression));
172-
for i in 0..16 {
173-
trace.base[POSEIDON_16_COL_INDEX_INPUT_START + i].push(input[i]);
172+
for (i, value) in input.iter().enumerate() {
173+
trace.base[POSEIDON_16_COL_INDEX_INPUT_START + i].push(*value);
174174
}
175-
for i in 0..8 {
176-
trace.base[POSEIDON_16_COL_INDEX_OUTPUT_START + i].push(res_a[i]);
175+
for (i, value) in res_a.iter().enumerate() {
176+
trace.base[POSEIDON_16_COL_INDEX_OUTPUT_START + i].push(*value);
177177
}
178-
for i in 0..8 {
179-
trace.base[POSEIDON_16_COL_INDEX_OUTPUT_START + 8 + i].push(res_b[i]);
178+
for (i, value) in res_b.iter().enumerate() {
179+
trace.base[POSEIDON_16_COL_INDEX_OUTPUT_START + 8 + i].push(*value);
180180
}
181181
Ok(())
182182
}

crates/lean_vm/src/tables/poseidon_24/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ impl TableT for Poseidon24Precompile {
146146
trace.base[POSEIDON_24_COL_INDEX_A_BIS].push(arg_a + F::ONE);
147147
trace.base[POSEIDON_24_COL_INDEX_B].push(arg_b);
148148
trace.base[POSEIDON_24_COL_INDEX_RES].push(res);
149-
for i in 0..24 {
150-
trace.base[POSEIDON_24_COL_INDEX_INPUT_START + i].push(input[i]);
149+
for (i, value) in input.iter().enumerate() {
150+
trace.base[POSEIDON_24_COL_INDEX_INPUT_START + i].push(*value);
151151
}
152-
for i in 0..8 {
153-
trace.base[POSEIDON_24_COL_INDEX_OUTPUT_START + i].push(output[i]);
152+
for (i, value) in output.iter().enumerate() {
153+
trace.base[POSEIDON_24_COL_INDEX_OUTPUT_START + i].push(*value);
154154
}
155155

156156
Ok(())

crates/lean_vm/src/tables/table_trait.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub trait TableT: Air {
221221
let mut statements = self
222222
.commited_columns_f()
223223
.iter()
224-
.map(|&c| vec![Evaluation::new(air_point.clone(), air_values_f[c].clone())])
224+
.map(|&c| vec![Evaluation::new(air_point.clone(), air_values_f[c])])
225225
.collect::<Vec<_>>();
226226
if let Some(ext_commitment_helper) = ext_commitment_helper {
227227
statements.extend(ext_commitment_helper.after_commitment(prover_state, air_point));
@@ -253,7 +253,7 @@ pub trait TableT: Air {
253253
let mut statements = self
254254
.commited_columns_f()
255255
.iter()
256-
.map(|&c| vec![Evaluation::new(air_point.clone(), air_values_f[c].clone())])
256+
.map(|&c| vec![Evaluation::new(air_point.clone(), air_values_f[c])])
257257
.collect::<Vec<_>>();
258258

259259
if self.n_commited_columns_ef() > 0 {
@@ -263,7 +263,7 @@ pub trait TableT: Air {
263263
air_point.clone(),
264264
self.commited_columns_ef()
265265
.iter()
266-
.map(|&c| air_values_ef[c].clone())
266+
.map(|&c| air_values_ef[c])
267267
.collect::<Vec<_>>(),
268268
),
269269
)?);
@@ -289,7 +289,7 @@ pub trait TableT: Air {
289289
for lookup in self.normal_lookups_f() {
290290
statements.push(vec![Evaluation::new(
291291
air_point.clone(),
292-
air_values_f[lookup.values].clone(),
292+
air_values_f[lookup.values],
293293
)]);
294294
}
295295
statements
@@ -304,7 +304,7 @@ pub trait TableT: Air {
304304
for lookup in self.normal_lookups_ef() {
305305
statements.push(vec![Evaluation::new(
306306
air_point.clone(),
307-
air_values_ef[lookup.values].clone(),
307+
air_values_ef[lookup.values],
308308
)]);
309309
}
310310
statements

crates/sub_protocols/src/normal_packed_lookup.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ where
150150
PF<EF>: PrimeField64,
151151
{
152152
// before receiving the commitment to the pushforward
153+
#[allow(clippy::too_many_arguments)]
153154
pub fn step_1<TF: ExtensionField<PF<EF>>>(
154155
verifier_state: &mut FSVerifier<EF, impl FSChallenger<EF>>,
155156
heights_f: Vec<usize>,

crates/utils/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@ pub fn encapsulate_vec<T>(v: Vec<T>) -> Vec<Vec<T>> {
142142
v.into_iter().map(|x| vec![x]).collect()
143143
}
144144

145-
pub fn collect_refs<'a, T>(vecs: &'a [Vec<T>]) -> Vec<&'a [T]> {
145+
pub fn collect_refs<T>(vecs: &[Vec<T>]) -> Vec<&[T]> {
146146
vecs.iter().map(Vec::as_slice).collect()
147147
}

0 commit comments

Comments
 (0)