use alloc::vec::Vec;
use core::marker::PhantomData;
+#[allow(clippy::needless_lifetimes)] // lifetimes improve readability
+#[allow(clippy::needless_borrow)] // borrows indicate read-only/non-move
+#[allow(clippy::too_many_arguments)] // sometimes we don't have an option
+#[allow(clippy::identity_op)] // sometimes identities improve readability for repeated actions
+
// **************************************
// * Implementations of math primitives *
// **************************************
if self > m { return Err(()); }
let mut t = [0; WORD_COUNT_4096];
- if &m.0[..WORD_COUNT_4096 - 1] == &[0; WORD_COUNT_4096 - 1] && m.0[WORD_COUNT_4096 - 1] == 1 {
+ if m.0[..WORD_COUNT_4096 - 1] == [0; WORD_COUNT_4096 - 1] && m.0[WORD_COUNT_4096 - 1] == 1 {
return Ok(U4096(t));
}
t[WORD_COUNT_4096 - 1] = 1;
let e: C::IntModP = C::IntModP::from_i(expected_x.clone().into_i());
if self.z == C::IntModP::ZERO { return Err(()); }
let ezz = e.mul(&self.z).mul(&self.z);
- if self.x == ezz { Ok(()) } else {
- if slow_check == Some(true) { Ok(()) } else { Err(()) }
- }
+ if self.x == ezz || slow_check == Some(true) { Ok(()) } else { Err(()) }
}
fn double(&self) -> Result<Self, ()> {
// Luckily, it seems to work fine in 1.63 with the feature flag (and RUSTC_BOOTSTRAP=1) enabled.
#![cfg_attr(all(feature = "validation", rust_1_63), feature(const_slice_from_raw_parts))]
+#![allow(clippy::needless_lifetimes)] // lifetimes improve readability
+#![allow(clippy::needless_borrow)] // borrows indicate read-only/non-move
+#![allow(clippy::too_many_arguments)] // sometimes we don't have an option
+#![allow(clippy::identity_op)] // sometimes identities improve readability for repeated actions
+#![allow(clippy::erasing_op)] // sometimes identities improve readability for repeated actions
+
extern crate alloc;
pub mod rr;
// Luckily, it seems to work fine in 1.63 with the feature flag (and RUSTC_BOOTSTRAP=1) enabled.
#![cfg_attr(rust_1_63, feature(const_slice_from_raw_parts))]
+#![allow(clippy::needless_lifetimes)] // lifetimes improve readability
+#![allow(clippy::needless_borrow)] // borrows indicate read-only/non-move
+#![allow(clippy::too_many_arguments)] // sometimes we don't have an option
+#![allow(clippy::identity_op)] // sometimes identities improve readability for repeated actions
+#![allow(clippy::erasing_op)] // sometimes identities improve readability for repeated actions
+
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;