From df30030c0e6e42bbbaf91cf186660cc261210979 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 8 Apr 2024 13:22:56 +0500 Subject: [PATCH] Some clippy fixes (#149) * MAX fixes for clippy * fix transmut without annotations * please the fmt gods --- evm_arithmetization/src/arithmetic/modular.rs | 8 ++++---- evm_arithmetization/src/fixed_recursive_verifier.rs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/evm_arithmetization/src/arithmetic/modular.rs b/evm_arithmetization/src/arithmetic/modular.rs index 70761d4be..f91bebe99 100644 --- a/evm_arithmetization/src/arithmetic/modular.rs +++ b/evm_arithmetization/src/arithmetic/modular.rs @@ -307,7 +307,7 @@ pub(crate) fn generate_modular_op( let (lo, hi) = quot_limbs.split_at_mut(N_LIMBS); // Verify that the elements are in the expected range. - debug_assert!(lo.iter().all(|&c| c <= u16::max_value() as i64)); + debug_assert!(lo.iter().all(|&c| c <= u16::MAX as i64)); // Top half of quot_limbs should be zero. debug_assert!(hi.iter().all(|&d| d.is_zero())); @@ -318,7 +318,7 @@ pub(crate) fn generate_modular_op( // it's in the range [0, 2^16 - 1] which will correctly // range-check. for c in lo { - *c += u16::max_value() as i64; + *c += u16::MAX as i64; } // Store the sign of the quotient after the quotient. hi[0] = 1; @@ -522,7 +522,7 @@ pub(crate) fn submod_constr_poly( let sign = hi[0]; // sign must be 1 (negative) or 0 (positive) yield_constr.constraint(filter * sign * (sign - P::ONES)); - let offset = P::Scalar::from_canonical_u16(u16::max_value()); + let offset = P::Scalar::from_canonical_u16(u16::MAX); for c in lo { *c -= offset * sign; } @@ -723,7 +723,7 @@ pub(crate) fn submod_constr_poly_ext_circuit, const let t = builder.mul_extension(filter, t); // sign must be 1 (negative) or 0 (positive) yield_constr.constraint(builder, t); - let offset = F::from_canonical_u16(u16::max_value()); + let offset = F::from_canonical_u16(u16::MAX); for c in lo { let t = builder.mul_const_extension(offset, sign); *c = builder.sub_extension(*c, t); diff --git a/evm_arithmetization/src/fixed_recursive_verifier.rs b/evm_arithmetization/src/fixed_recursive_verifier.rs index a60b9e7e3..be65eb413 100644 --- a/evm_arithmetization/src/fixed_recursive_verifier.rs +++ b/evm_arithmetization/src/fixed_recursive_verifier.rs @@ -399,7 +399,10 @@ where *table = MaybeUninit::new(value); } unsafe { - mem::transmute::<_, [RecursiveCircuitsForTable; NUM_TABLES]>(by_table) + mem::transmute::< + [std::mem::MaybeUninit>; NUM_TABLES], + [RecursiveCircuitsForTable; NUM_TABLES], + >(by_table) } } };