Skip to content

Commit 1bca2de

Browse files
committed
refactor: clean up clippy setup
1 parent c7f753c commit 1bca2de

File tree

26 files changed

+22
-10
lines changed

26 files changed

+22
-10
lines changed

.cargo/config

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ xclippy = [
1818
"-Wclippy::from_iter_instead_of_collect",
1919
"-Wclippy::implicit_clone",
2020
"-Wclippy::inefficient_to_string",
21+
"-Wclippy::invalid_upcast_comparisons",
2122
"-Wclippy::large_stack_arrays",
2223
"-Wclippy::large_types_passed_by_value",
2324
"-Wclippy::macro_use_imports",

.clippy.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
type-complexity-threshold = 1200
2+
too-many-arguments-threshold = 20

core/src/alu/add_sub/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ where
170170
);
171171

172172
// Degree 3 constraint to avoid "OodEvaluationMismatch".
173+
#[allow(clippy::eq_op)]
173174
builder.assert_zero(
174175
local.operand_1[0] * local.operand_1[0] * local.operand_1[0]
175176
- local.operand_1[0] * local.operand_1[0] * local.operand_1[0],

core/src/alu/bitwise/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ where
143143
);
144144

145145
// Degree 3 constraint to avoid "OodEvaluationMismatch".
146+
#[allow(clippy::eq_op)]
146147
builder.assert_zero(
147148
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
148149
);

core/src/alu/divrem/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ where
743743
}
744744

745745
// A dummy constraint to keep the degree 3.
746+
#[allow(clippy::eq_op)]
746747
builder.assert_zero(
747748
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
748749
)

core/src/alu/lt/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ where
195195
let one = AB::Expr::one();
196196

197197
// Dummy degree 3 constraint to avoid "OodEvaluationMismatch".
198+
#[allow(clippy::eq_op)]
198199
builder.assert_zero(
199200
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
200201
);

core/src/alu/mul/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ where
427427
builder.receive_alu(opcode, local.a, local.b, local.c, local.is_real);
428428

429429
// A dummy constraint to keep the degree at least 3.
430+
#[allow(clippy::eq_op)]
430431
builder.assert_zero(
431432
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
432433
);

core/src/alu/sll/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ where
334334
);
335335

336336
// A dummy constraint to keep the degree at least 3.
337+
#[allow(clippy::eq_op)]
337338
builder.assert_zero(
338339
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
339340
);

core/src/alu/sr/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ where
448448
}
449449
}
450450

451+
#[allow(clippy::eq_op)]
452+
// A dummy constraint to keep the degree at least 3.
451453
builder.assert_zero(
452454
local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0],
453455
);

core/src/bytes/air.rs

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ impl<AB: SP1AirBuilder> Air<AB> for ByteChip<AB::F> {
7878
}
7979

8080
// Dummy constraint for normalizing to degree 3.
81+
#[allow(clippy::eq_op)]
8182
builder.assert_zero(local.b * local.b * local.b - local.b * local.b * local.b);
8283
}
8384
}

core/src/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
#![allow(
2-
clippy::eq_op,
32
clippy::new_without_default,
43
clippy::field_reassign_with_default,
5-
clippy::unnecessary_cast,
64
clippy::cast_abs_to_unsigned,
75
clippy::needless_range_loop,
8-
clippy::type_complexity,
9-
clippy::unnecessary_unwrap,
106
clippy::default_constructed_unit_structs,
11-
clippy::box_default,
127
deprecated
138
)]
149

core/src/operations/add.rs

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ impl<F: Field> AddOperation<F> {
103103
}
104104

105105
// Degree 3 constraint to avoid "OodEvaluationMismatch".
106+
#[allow(clippy::eq_op)]
106107
builder.assert_zero(a[0] * b[0] * cols.value[0] - a[0] * b[0] * cols.value[0]);
107108
}
108109
}

core/src/operations/add4.rs

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ impl<F: Field> Add4Operation<F> {
147147
}
148148

149149
// Degree 3 constraint to avoid "OodEvaluationMismatch".
150+
#[allow(clippy::eq_op)]
150151
builder.assert_zero(a[0] * b[0] * cols.value[0] - a[0] * b[0] * cols.value[0]);
151152
}
152153
}

core/src/operations/add5.rs

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ impl<F: Field> Add5Operation<F> {
167167
}
168168

169169
// Degree 3 constraint to avoid "OodEvaluationMismatch".
170+
#[allow(clippy::eq_op)]
170171
builder.assert_zero(is_real * is_real * is_real - is_real * is_real * is_real);
171172
}
172173
}

core/src/operations/field/extensions/quadratic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ mod tests {
459459
.eval::<AB, P, _, _>(builder, &local.a, &local.b, self.operation);
460460

461461
// A dummy constraint to keep the degree 3.
462+
#[allow(clippy::eq_op)]
462463
builder.assert_zero(
463464
local.a[0][0] * local.b[0][0] * local.a[0][0]
464465
- local.a[0][0] * local.b[0][0] * local.a[0][0],

core/src/operations/field/field_den.rs

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ mod tests {
250250
.eval::<AB, P>(builder, &local.a, &local.b, self.sign);
251251

252252
// A dummy constraint to keep the degree 3.
253+
#[allow(clippy::eq_op)]
253254
builder.assert_zero(
254255
local.a[0] * local.b[0] * local.a[0] - local.a[0] * local.b[0] * local.a[0],
255256
)

core/src/operations/field/field_inner_product.rs

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ mod tests {
241241
.eval::<AB, P, _>(builder, local.a.clone(), local.b.clone());
242242

243243
// A dummy constraint to keep the degree 3.
244+
#[allow(clippy::eq_op)]
244245
builder.assert_zero(
245246
local.a[0][0] * local.b[0][0] * local.a[0][0]
246247
- local.a[0][0] * local.b[0][0] * local.a[0][0],

core/src/operations/field/field_op.rs

+1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ mod tests {
301301
.eval::<AB, P, _, _>(builder, &local.a, &local.b, self.operation);
302302

303303
// A dummy constraint to keep the degree 3.
304+
#[allow(clippy::eq_op)]
304305
builder.assert_zero(
305306
local.a[0] * local.b[0] * local.a[0] - local.a[0] * local.b[0] * local.a[0],
306307
)

core/src/operations/field/field_sqrt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ mod tests {
192192
local.sqrt.eval::<AB, P>(builder, &local.a);
193193

194194
// A dummy constraint to keep the degree 3.
195+
#[allow(clippy::eq_op)]
195196
builder.assert_zero(
196197
local.a[0] * local.a[0] * local.a[0] - local.a[0] * local.a[0] * local.a[0],
197198
)

core/src/operations/not.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl<F: Field> NotOperation<F> {
5353
}
5454

5555
// A dummy constraint to keep the degree 3.
56+
#[allow(clippy::eq_op)]
5657
builder.assert_zero(a[0] * a[0] * a[0] - a[0] * a[0] * a[0]);
5758
}
5859
}

core/src/runtime/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ impl Runtime {
343343
}
344344

345345
/// Emit a CPU event.
346-
#[allow(clippy::too_many_arguments)]
347346
fn emit_cpu(
348347
&mut self,
349348
shard: u32,

core/src/stark/quotient.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use p3_util::log2_strict_usize;
1717

1818
use super::StarkGenericConfig;
1919

20-
#[allow(clippy::too_many_arguments)]
2120
pub fn quotient_values<SC, A, Mat>(
2221
chip: &Chip<Val<SC>, A>,
2322
cumulative_sum: SC::Challenge,

core/src/syscall/precompiles/blake3/compress/g.rs

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ impl<F: Field> GOperation<F> {
179179
}
180180
}
181181
// Degree 3 constraint to avoid "OodEvaluationMismatch".
182+
#[allow(clippy::eq_op)]
182183
builder.assert_zero(is_real * is_real * is_real - is_real * is_real * is_real);
183184
}
184185
}

recursion/core/src/runtime/instruction.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub struct Instruction<F> {
2626
}
2727

2828
impl<F: PrimeField32> Instruction<F> {
29-
#[allow(clippy::too_many_arguments)]
3029
pub fn new(
3130
opcode: Opcode,
3231
op_a: F,

recursion/program/src/constraints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ where
119119
}
120120

121121
/// Reference: `[sp1_core::stark::Verifier::verify_constraints]`
122-
#[allow(clippy::too_many_arguments)]
123122
pub fn verify_constraints<A>(
124123
builder: &mut Builder<C>,
125124
chip: &MachineChip<SC, A>,

recursion/program/src/fri/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ pub fn verify_challenges<C: Config>(
116116
/// Currently assumes the index that is accessed is constant.
117117
///
118118
/// Reference: https://github.com/Plonky3/Plonky3/blob/4809fa7bedd9ba8f6f5d3267b1592618e3776c57/fri/src/verifier.rs#L101
119-
#[allow(clippy::too_many_arguments)]
120119
#[allow(unused_variables)]
121120
pub fn verify_query<C: Config>(
122121
builder: &mut Builder<C>,

0 commit comments

Comments
 (0)