Skip to content

Commit e459884

Browse files
authored
Fix latest clippy (#1676)
* Fix latest clippy * wasm
1 parent fda13dd commit e459884

File tree

4 files changed

+5
-40
lines changed

4 files changed

+5
-40
lines changed

plonky2/src/gates/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<'a, P: PackedField> StridedConstraintConsumer<'a, P> {
4141

4242
/// Emit one constraint.
4343
pub fn one(&mut self, constraint: P) {
44-
if self.start != self.end {
44+
if !core::ptr::eq(self.start, self.end) {
4545
// # Safety
4646
// The checks in `new` guarantee that this points to valid space.
4747
unsafe {

plonky2/src/hash/arch/aarch64/poseidon_goldilocks_neon.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,6 @@ const fn check_mds_matrix() -> bool {
5454
}
5555
const_assert!(check_mds_matrix());
5656

57-
/// Ensure that the first WIDTH round constants are in canonical* form. This is required because
58-
/// the first constant layer does not handle double overflow.
59-
/// *: round_const == GoldilocksField::ORDER is safe.
60-
/*
61-
#[allow(dead_code)]
62-
const fn check_round_const_bounds_init() -> bool {
63-
let mut i = 0;
64-
while i < WIDTH {
65-
if ALL_ROUND_CONSTANTS[i] > GoldilocksField::ORDER {
66-
return false;
67-
}
68-
i += 1;
69-
}
70-
true
71-
}
72-
const_assert!(check_round_const_bounds_init());
73-
*/
7457
// ====================================== SCALAR ARITHMETIC =======================================
7558

7659
/// Addition modulo ORDER accounting for wraparound. Correct only when a + b < 2**64 + ORDER.
@@ -149,26 +132,6 @@ unsafe fn multiply(x: u64, y: u64) -> u64 {
149132
add_with_wraparound(res0, xy_hi_lo_mul_epsilon)
150133
}
151134

152-
// ==================================== STANDALONE CONST LAYER =====================================
153-
154-
/// Standalone const layer. Run only once, at the start of round 1. Remaining const layers are fused
155-
/// with the preceding MDS matrix multiplication.
156-
/*
157-
#[inline(always)]
158-
#[unroll_for_loops]
159-
unsafe fn const_layer_full(
160-
mut state: [u64; WIDTH],
161-
round_constants: &[u64; WIDTH],
162-
) -> [u64; WIDTH] {
163-
assert!(WIDTH == 12);
164-
for i in 0..12 {
165-
let rc = round_constants[i];
166-
// add_with_wraparound is safe, because rc is in canonical form.
167-
state[i] = add_with_wraparound(state[i], rc);
168-
}
169-
state
170-
}
171-
*/
172135
// ========================================== FULL ROUNDS ==========================================
173136

174137
/// Full S-box.

plonky2/src/hash/arch/x86_64/poseidon_goldilocks_avx2_bmi2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::assertions_on_constants)]
2+
13
use core::arch::asm;
24
use core::arch::x86_64::*;
35
use core::mem::size_of;

plonky2/src/util/strided_view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<'a, P: PackedField> Iterator for PackedStridedViewIter<'a, P> {
203203
"start and end pointers should be separated by a multiple of stride"
204204
);
205205

206-
if self.start != self.end {
206+
if !core::ptr::eq(self.start, self.end) {
207207
let res = unsafe { &*self.start.cast() };
208208
// See comment in `PackedStridedView`. Below will point more than one byte past the end
209209
// of the buffer if the offset is not 0 and we've reached the end.
@@ -224,7 +224,7 @@ impl<P: PackedField> DoubleEndedIterator for PackedStridedViewIter<'_, P> {
224224
"start and end pointers should be separated by a multiple of stride"
225225
);
226226

227-
if self.start != self.end {
227+
if !core::ptr::eq(self.start, self.end) {
228228
// See comment in `PackedStridedView`. `self.end` starts off pointing more than one byte
229229
// past the end of the buffer unless `offset` is 0.
230230
self.end = self.end.wrapping_sub(self.stride);

0 commit comments

Comments
 (0)