Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
rupansh committed Apr 3, 2024
1 parent e1bb76a commit 44bfddd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pub struct Signature {
impl core::fmt::Debug for Signature {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
fmt.debug_struct("Signature")
.field("R_bytes", &hex::encode(&self.R_bytes))
.field("s_bytes", &hex::encode(&self.s_bytes))
.field("R_bytes", &hex::encode(self.R_bytes))
.field("s_bytes", &hex::encode(self.s_bytes))
.finish()
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ impl SigningKey {
impl core::fmt::Debug for SigningKey {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
fmt.debug_struct("SigningKey")
.field("seed", &hex::encode(&self.seed))
.field("seed", &hex::encode(self.seed))
.field("s", &self.s)
.field("prefix", &hex::encode(&self.prefix))
.field("prefix", &hex::encode(self.prefix))
.field("vk", &self.vk)
.finish()
}
Expand Down
4 changes: 2 additions & 2 deletions src/verification_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl VerificationKeyBytes {
impl core::fmt::Debug for VerificationKeyBytes {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
fmt.debug_tuple("VerificationKeyBytes")
.field(&hex::encode(&self.0))
.field(&hex::encode(self.0))
.finish()
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@ impl core::hash::Hash for VerificationKey {
impl core::fmt::Debug for VerificationKey {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
fmt.debug_tuple("VerificationKey")
.field(&hex::encode(&self.A_bytes.0))
.field(&hex::encode(self.A_bytes.0))
.finish()
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/rfc8032.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//! so these are basic sanity checks, rather than the more detailed test vectors
//! in consensus.rs.
use bincode;

use ed25519_consensus::*;
use hex;


fn rfc8032_test_case(sk_bytes: Vec<u8>, pk_bytes: Vec<u8>, sig_bytes: Vec<u8>, msg: Vec<u8>) {
let sk: SigningKey = bincode::deserialize(&sk_bytes).expect("sk should deserialize");
Expand Down
10 changes: 2 additions & 8 deletions tests/small_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,9 @@ pub static SMALL_ORDER_SIGS: Lazy<Vec<TestCase>> = Lazy::new(|| {
);
let check = R + k * A;
let non_canonical_R = R.compress().as_bytes() != R_bytes;
let valid_legacy = if vk_bytes == [0; 32]
let valid_legacy = !(vk_bytes == [0; 32]
|| util::EXCLUDED_POINT_ENCODINGS.contains(R.compress().as_bytes())
|| !check.is_identity()
|| non_canonical_R
{
false
} else {
true
};
|| !check.is_identity() || non_canonical_R);

tests.push(TestCase {
vk_bytes,
Expand Down
10 changes: 4 additions & 6 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use color_eyre::{eyre::eyre, Report};
use curve25519_dalek::edwards::{CompressedEdwardsY, EdwardsPoint};
use ed25519_consensus;


use std::convert::TryFrom;
pub struct TestCase {
Expand Down Expand Up @@ -181,12 +181,10 @@ pub fn order(point: EdwardsPoint) -> &'static str {
} else {
"8"
}
} else if point.is_torsion_free() {
"p"
} else {
if point.is_torsion_free() {
"p"
} else {
"8p"
}
"8p"
}
}

Expand Down

0 comments on commit 44bfddd

Please sign in to comment.