]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Make crypto/ clippy-clean, mostly by telling clippy to shut up
authorMatt Corallo <git@bluematt.me>
Tue, 7 May 2024 17:10:45 +0000 (17:10 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 7 May 2024 17:30:52 +0000 (17:30 +0000)
src/crypto/bigint.rs
src/crypto/ec.rs
src/http.rs
src/lib.rs

index a9245a47884866d2669ecb6eb2035c6a208ff257..eec0a56f8d380745e61b5e2486fe9b608859674c 100644 (file)
@@ -3,6 +3,11 @@
 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 *
 // **************************************
@@ -698,7 +703,7 @@ impl U4096 {
                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;
index bd8c5cfea98a53ed12ccc34ea7a43aad154ff4d4..7562deb111330ba360e0caa86e9bdf30c1417763 100644 (file)
@@ -142,9 +142,7 @@ impl<C: Curve + ?Sized> Point<C> {
                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, ()> {
index 76c54c1b02b8e43c341c0ef52a725eead8d32683..0656c4c7369ad1efadda51314152e87fd5ec9505 100644 (file)
@@ -6,6 +6,12 @@
 // 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;
index 77c3cd94695e0a2d76f78aeb263a5567e7cb8554..c402a720bd49e3b512d34c1db084b10a32ba743c 100644 (file)
 // 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;