Skip to content

Commit 0e16746

Browse files
committed
Getting rid of SecretKey display methods
1 parent b9e3c9d commit 0e16746

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/key.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,6 @@ pub struct SecretKey(pub(crate) [u8; constants::SECRET_KEY_SIZE]);
3131
impl_array_newtype!(SecretKey, u8, constants::SECRET_KEY_SIZE);
3232
impl_display_secret!(SecretKey);
3333

34-
impl fmt::LowerHex for SecretKey {
35-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36-
for ch in &self.0[..] {
37-
write!(f, "{:02x}", *ch)?;
38-
}
39-
Ok(())
40-
}
41-
}
42-
43-
impl fmt::Display for SecretKey {
44-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45-
fmt::LowerHex::fmt(self, f)
46-
}
47-
}
48-
4934
impl str::FromStr for SecretKey {
5035
type Err = Error;
5136
fn from_str(s: &str) -> Result<SecretKey, Error> {
@@ -704,10 +689,11 @@ mod test {
704689
let pk = PublicKey::from_slice(&[0x02, 0x18, 0x84, 0x57, 0x81, 0xf6, 0x31, 0xc4, 0x8f, 0x1c, 0x97, 0x09, 0xe2, 0x30, 0x92, 0x06, 0x7d, 0x06, 0x83, 0x7f, 0x30, 0xaa, 0x0c, 0xd0, 0x54, 0x4a, 0xc8, 0x87, 0xfe, 0x91, 0xdd, 0xd1, 0x66]).expect("pk");
705690
let mut buf = [0u8; constants::SECRET_KEY_SIZE * 2];
706691

692+
#[allow(deprecated)] {
707693
assert_eq!(
708694
to_hex(&sk[..], &mut buf).unwrap(),
709695
"01010101010101010001020304050607ffff0000ffff00006363636363636363"
710-
);
696+
) };
711697
assert_eq!(
712698
SecretKey::from_str("01010101010101010001020304050607ffff0000ffff00006363636363636363").unwrap(),
713699
sk

0 commit comments

Comments
 (0)