Skip to content

Commit 800eda2

Browse files
authored
ecdsa: make fmt impls more consistent (#713)
1 parent 31ebc99 commit 800eda2

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

ecdsa/src/lib.rs

+17-20
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ pub use crate::signing::SigningKey;
8383
#[cfg(feature = "verifying")]
8484
pub use crate::verifying::VerifyingKey;
8585

86-
use core::{
87-
fmt::{self, Debug},
88-
ops::Add,
89-
};
86+
use core::{fmt, ops::Add};
9087
use elliptic_curve::{
9188
generic_array::{sequence::Concat, typenum::Unsigned, ArrayLength, GenericArray},
9289
FieldBytes, FieldBytesSize, ScalarPrimitive,
@@ -321,22 +318,6 @@ where
321318
{
322319
}
323320

324-
impl<C> Debug for Signature<C>
325-
where
326-
C: PrimeCurve,
327-
SignatureSize<C>: ArrayLength<u8>,
328-
{
329-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
330-
write!(f, "ecdsa::Signature<{:?}>(", C::default())?;
331-
332-
for byte in self.to_bytes() {
333-
write!(f, "{:02X}", byte)?;
334-
}
335-
336-
write!(f, ")")
337-
}
338-
}
339-
340321
impl<C> From<Signature<C>> for SignatureBytes<C>
341322
where
342323
C: PrimeCurve,
@@ -367,6 +348,22 @@ where
367348
}
368349
}
369350

351+
impl<C> fmt::Debug for Signature<C>
352+
where
353+
C: PrimeCurve,
354+
SignatureSize<C>: ArrayLength<u8>,
355+
{
356+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
357+
write!(f, "ecdsa::Signature<{:?}>(", C::default())?;
358+
359+
for byte in self.to_bytes() {
360+
write!(f, "{:02X}", byte)?;
361+
}
362+
363+
write!(f, ")")
364+
}
365+
}
366+
370367
impl<C> fmt::Display for Signature<C>
371368
where
372369
C: PrimeCurve,

0 commit comments

Comments
 (0)