Skip to content

Commit

Permalink
Address clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jul 22, 2023
1 parent e44d4b5 commit 9112228
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions curve25519-dalek-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ pub fn unsafe_target_feature_specialize(
let features: Vec<_> = attributes
.lit()
.value()
.split(",")
.map(|feature| feature.replace(" ", ""))
.split(',')
.map(|feature| feature.replace(' ', ""))
.collect();
let name = format!("{}_{}", item_mod.ident, features.join("_"));
let ident = syn::Ident::new(&name, item_mod.ident.span());
Expand Down
6 changes: 1 addition & 5 deletions curve25519-dalek-derive/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ impl<T: Copy + core::ops::Sub> StructWithGenericsNoWhere<T> {
#[unsafe_target_feature("sse2")]
#[allow(dead_code)]
impl<'a> From<&'a Struct> for () {
fn from(_: &'a Struct) -> Self {
()
}
fn from(_: &'a Struct) -> Self {}
}

#[unsafe_target_feature("sse2")]
Expand All @@ -97,8 +95,6 @@ mod inner {

#[unsafe_target_feature_specialize("sse2", "avx2", conditional("avx512ifma", disabled))]
mod inner_spec {
use std;

#[for_target_feature("sse2")]
const CONST: u32 = 1;

Expand Down
6 changes: 3 additions & 3 deletions curve25519-dalek/benches/dalek_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ mod multiscalar_benches {
let static_size = total_size;

let static_points = construct_points(static_size);
let precomp = VartimeEdwardsPrecomputation::new(&static_points);
let precomp = VartimeEdwardsPrecomputation::new(static_points);
// Rerandomize the scalars for every call to prevent
// false timings from better caching (e.g., the CPU
// cache lifts exactly the right table entries for the
// benchmark into the highest cache levels).
b.iter_batched(
|| construct_scalars(static_size),
|scalars| precomp.vartime_multiscalar_mul(&scalars),
|scalars| precomp.vartime_multiscalar_mul(scalars),
BatchSize::SmallInput,
);
},
Expand Down Expand Up @@ -182,7 +182,7 @@ mod multiscalar_benches {

let static_points = construct_points(static_size);
let dynamic_points = construct_points(dynamic_size);
let precomp = VartimeEdwardsPrecomputation::new(&static_points);
let precomp = VartimeEdwardsPrecomputation::new(static_points);
// Rerandomize the scalars for every call to prevent
// false timings from better caching (e.g., the CPU
// cache lifts exactly the right table entries for the
Expand Down
4 changes: 2 additions & 2 deletions curve25519-dalek/src/ristretto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ mod test {
let bp_compressed_ristretto = constants::RISTRETTO_BASEPOINT_POINT.compress();
let bp_recaf = bp_compressed_ristretto.decompress().unwrap().0;
// Check that bp_recaf differs from bp by a point of order 4
let diff = &constants::RISTRETTO_BASEPOINT_POINT.0 - bp_recaf;
let diff = constants::RISTRETTO_BASEPOINT_POINT.0 - bp_recaf;
let diff4 = diff.mul_by_pow_2(2);
assert_eq!(diff4.compress(), CompressedEdwardsY::identity());
}
Expand Down Expand Up @@ -1681,7 +1681,7 @@ mod test {
];
// Check that onewaymap(input) == output for all the above vectors
for (input, output) in test_vectors {
let Q = RistrettoPoint::from_uniform_bytes(&input);
let Q = RistrettoPoint::from_uniform_bytes(input);
assert_eq!(&Q.compress(), output);
}
}
Expand Down
6 changes: 3 additions & 3 deletions ed25519-dalek/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ mod test {
#[test]
fn sign_verify_nonspec() {
// Generate the keypair
let mut rng = OsRng;
let esk = ExpandedSecretKey::random(&mut rng);
let rng = OsRng;
let esk = ExpandedSecretKey::random(rng);
let vk = VerifyingKey::from(&esk);

let msg = b"Then one day, a piano fell on my head";

// Sign and verify
let sig = raw_sign::<CtxDigest>(&esk, msg, &vk);
raw_verify::<CtxDigest>(&vk, msg, &sig).unwrap();
raw_verify::<CtxDigest>(&vk, msg, &sig).expect("verification should succeed");
}

// Check that raw_sign_prehashed and raw_verify_prehashed work when distinct, non-spec
Expand Down

0 comments on commit 9112228

Please sign in to comment.