Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Nov 11, 2023
1 parent 1d3f075 commit 8528581
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 21 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/crypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,3 @@ jobs:
- run: cargo test --no-default-features --release
- run: cargo test --release
- run: cargo test --all-features --release

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.65.0
components: clippy
- run: cargo clippy --all --all-features -- -D warnings
1 change: 0 additions & 1 deletion elliptic-curve/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ impl Invert for Scalar {
impl Reduce<U256> for Scalar {
type Bytes = FieldBytes;

#[allow(clippy::integer_arithmetic)]
fn reduce(w: U256) -> Self {
let (r, underflow) = w.sbb(&MockCurve::ORDER, Limb::ZERO);
let underflow = Choice::from((underflow.0 >> (Limb::BITS - 1)) as u8);
Expand Down
3 changes: 0 additions & 3 deletions elliptic-curve/src/hash2curve/hash2field/expand_msg/xmd.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! `expand_message_xmd` based on a hash function.
// TODO(tarcieri): checked arithmetic
#![allow(clippy::integer_arithmetic)]

use core::marker::PhantomData;

use super::{Domain, ExpandMsg, Expander};
Expand Down
1 change: 0 additions & 1 deletion elliptic-curve/src/hash2curve/isogeny.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub trait Isogeny: Field + AddAssign + Mul<Output = Self> {
const COEFFICIENTS: IsogenyCoefficients<Self>;

/// Map from the isogeny points to the main curve
#[allow(clippy::integer_arithmetic)]
fn isogeny(x: Self, y: Self) -> (Self, Self) {
let mut xs = GenericArray::<Self, Self::Degree>::default();
xs[0] = Self::ONE;
Expand Down
1 change: 0 additions & 1 deletion elliptic-curve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
clippy::cast_sign_loss,
clippy::checked_conversions,
clippy::implicit_saturating_sub,
clippy::integer_arithmetic,
clippy::mod_module_files,
clippy::panic,
clippy::panic_in_result_fn,
Expand Down
3 changes: 2 additions & 1 deletion elliptic-curve/src/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ where
/// Initialize [`PublicKey`] from an [`EncodedPoint`]
fn from_encoded_point(encoded_point: &EncodedPoint<C>) -> CtOption<Self> {
AffinePoint::<C>::from_encoded_point(encoded_point).and_then(|point| {
let is_identity = Choice::from(encoded_point.is_identity() as u8);
// Defeating the point of `subtle`, but the use case is specifically a public key
let is_identity = Choice::from(u8::from(encoded_point.is_identity()));
CtOption::new(PublicKey { point }, !is_identity)
})
}
Expand Down
2 changes: 1 addition & 1 deletion elliptic-curve/src/sec1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ where
}
}

#[cfg(all(feature = "arithmetic"))]
#[cfg(feature = "arithmetic")]
impl<C> ValidatePublicKey for C
where
C: CurveArithmetic,
Expand Down
4 changes: 2 additions & 2 deletions elliptic-curve/src/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ where
}

/// Deserialize secret key encoded in the SEC1 ASN.1 DER `ECPrivateKey` format.
#[cfg(all(feature = "sec1"))]
#[cfg(feature = "sec1")]
pub fn from_sec1_der(der_bytes: &[u8]) -> Result<Self>
where
C: Curve + ValidatePublicKey,
Expand Down Expand Up @@ -344,7 +344,7 @@ where
}
}

#[cfg(all(feature = "sec1"))]
#[cfg(feature = "sec1")]
impl<C> TryFrom<sec1::EcPrivateKey<'_>> for SecretKey<C>
where
C: Curve + ValidatePublicKey,
Expand Down

0 comments on commit 8528581

Please sign in to comment.