From c05f6cb9ee098b0adc8fc0c5a55a9457f41a8458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 24 Jun 2024 17:48:49 +0300 Subject: [PATCH] Fix Clippy lints --- aead/src/stream.rs | 2 +- elliptic-curve/src/jwk.rs | 1 + elliptic-curve/src/public_key.rs | 1 + elliptic-curve/src/scalar/nonzero.rs | 6 ++++-- password-hash/src/encoding.rs | 3 +++ 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/aead/src/stream.rs b/aead/src/stream.rs index 27ff31281..7f735fb2a 100644 --- a/aead/src/stream.rs +++ b/aead/src/stream.rs @@ -399,7 +399,7 @@ where type NonceOverhead = U5; type Counter = u32; const COUNTER_INCR: u32 = 1; - const COUNTER_MAX: u32 = core::u32::MAX; + const COUNTER_MAX: u32 = u32::MAX; fn encrypt_in_place( &self, diff --git a/elliptic-curve/src/jwk.rs b/elliptic-curve/src/jwk.rs index 6e59d9fae..e37cd2769 100644 --- a/elliptic-curve/src/jwk.rs +++ b/elliptic-curve/src/jwk.rs @@ -168,6 +168,7 @@ impl FromStr for JwkEcKey { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for JwkEcKey { fn to_string(&self) -> String { serde_json::to_string(self).expect("JWK encoding error") diff --git a/elliptic-curve/src/public_key.rs b/elliptic-curve/src/public_key.rs index 4242c8c11..ddad0aa0b 100644 --- a/elliptic-curve/src/public_key.rs +++ b/elliptic-curve/src/public_key.rs @@ -503,6 +503,7 @@ where } #[cfg(feature = "pem")] +#[allow(clippy::to_string_trait_impl)] impl ToString for PublicKey where C: AssociatedOid + CurveArithmetic, diff --git a/elliptic-curve/src/scalar/nonzero.rs b/elliptic-curve/src/scalar/nonzero.rs index 7b81a6053..601206ad0 100644 --- a/elliptic-curve/src/scalar/nonzero.rs +++ b/elliptic-curve/src/scalar/nonzero.rs @@ -47,6 +47,8 @@ where // While this method isn't constant-time, the attacker shouldn't learn // anything about unrelated outputs so long as `rng` is a secure `CryptoRng`. loop { + // TODO: remove after `Field::random` switches to `&mut impl RngCore` + #[allow(clippy::needless_borrows_for_generic_args)] if let Some(result) = Self::new(Field::random(&mut rng)).into() { break result; } @@ -270,11 +272,11 @@ where Scalar: Reduce + ReduceNonZero, { fn reduce_nonzero(n: I) -> Self { - Self::reduce(n) + >::reduce(n) } fn reduce_nonzero_bytes(bytes: &Self::Bytes) -> Self { - Self::reduce_bytes(bytes) + >::reduce_bytes(bytes) } } diff --git a/password-hash/src/encoding.rs b/password-hash/src/encoding.rs index 7e7938f4d..8a914cee7 100644 --- a/password-hash/src/encoding.rs +++ b/password-hash/src/encoding.rs @@ -39,8 +39,11 @@ pub enum Encoding { /// - sha256_crypt, /// - sha512_crypt, /// - md5_crypt + /// + /// ```text /// [.-9] [A-Z] [a-z] /// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a + /// ``` ShaCrypt, }