Fix latest clippy (#1676)

* Fix latest clippy

* wasm
This commit is contained in:
Robin Salen
2025-03-24 11:36:53 -04:00
committed by GitHub
parent fda13ddc36
commit e459884ec7
4 changed files with 5 additions and 40 deletions

View File

@@ -41,7 +41,7 @@ impl<'a, P: PackedField> StridedConstraintConsumer<'a, P> {
/// Emit one constraint.
pub fn one(&mut self, constraint: P) {
if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
// # Safety
// The checks in `new` guarantee that this points to valid space.
unsafe {

View File

@@ -54,23 +54,6 @@ const fn check_mds_matrix() -> bool {
}
const_assert!(check_mds_matrix());
/// Ensure that the first WIDTH round constants are in canonical* form. This is required because
/// the first constant layer does not handle double overflow.
/// *: round_const == GoldilocksField::ORDER is safe.
/*
#[allow(dead_code)]
const fn check_round_const_bounds_init() -> bool {
let mut i = 0;
while i < WIDTH {
if ALL_ROUND_CONSTANTS[i] > GoldilocksField::ORDER {
return false;
}
i += 1;
}
true
}
const_assert!(check_round_const_bounds_init());
*/
// ====================================== SCALAR ARITHMETIC =======================================
/// 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 {
add_with_wraparound(res0, xy_hi_lo_mul_epsilon)
}
// ==================================== STANDALONE CONST LAYER =====================================
/// Standalone const layer. Run only once, at the start of round 1. Remaining const layers are fused
/// with the preceding MDS matrix multiplication.
/*
#[inline(always)]
#[unroll_for_loops]
unsafe fn const_layer_full(
mut state: [u64; WIDTH],
round_constants: &[u64; WIDTH],
) -> [u64; WIDTH] {
assert!(WIDTH == 12);
for i in 0..12 {
let rc = round_constants[i];
// add_with_wraparound is safe, because rc is in canonical form.
state[i] = add_with_wraparound(state[i], rc);
}
state
}
*/
// ========================================== FULL ROUNDS ==========================================
/// Full S-box.

View File

@@ -1,3 +1,5 @@
#![allow(clippy::assertions_on_constants)]
use core::arch::asm;
use core::arch::x86_64::*;
use core::mem::size_of;

View File

@@ -203,7 +203,7 @@ impl<'a, P: PackedField> Iterator for PackedStridedViewIter<'a, P> {
"start and end pointers should be separated by a multiple of stride"
);
if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
let res = unsafe { &*self.start.cast() };
// See comment in `PackedStridedView`. Below will point more than one byte past the end
// 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> {
"start and end pointers should be separated by a multiple of stride"
);
if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
// See comment in `PackedStridedView`. `self.end` starts off pointing more than one byte
// past the end of the buffer unless `offset` is 0.
self.end = self.end.wrapping_sub(self.stride);