Remove unneeded explicit reference

Clippy emits:

  warning: this expression creates a reference which is immediately
  dereferenced by the compiler

Remove the explicit reference.
This commit is contained in:
Tobin C. Harding 2022-06-10 12:29:16 +10:00
parent 35d59e7cc6
commit c15b9d2699
3 changed files with 7 additions and 7 deletions

View File

@ -176,7 +176,7 @@ impl ::serde::Serialize for SharedSecret {
let mut buf = [0u8; SHARED_SECRET_SIZE * 2];
s.serialize_str(crate::to_hex(&self.0, &mut buf).expect("fixed-size hex serialization"))
} else {
s.serialize_bytes(&self.as_ref()[..])
s.serialize_bytes(self.as_ref())
}
}
}

View File

@ -431,7 +431,7 @@ impl PublicKey {
#[cfg(feature = "global-context")]
#[cfg_attr(docsrs, doc(cfg(feature = "global-context")))]
pub fn from_secret_key_global(sk: &SecretKey) -> PublicKey {
PublicKey::from_secret_key(&SECP256K1, sk)
PublicKey::from_secret_key(SECP256K1, sk)
}
/// Creates a public key directly from a slice.
@ -1621,7 +1621,7 @@ pub mod serde_keypair {
let secret_key = SecretKey::deserialize(deserializer)?;
Ok(KeyPair::from_secret_key(
&crate::SECP256K1,
crate::SECP256K1,
&secret_key,
))
}

View File

@ -729,10 +729,10 @@ mod tests {
assert_eq!(
ecdsa::Signature::from_der(&byte_str).expect("byte str decode"),
ecdsa::Signature::from_str(&hex_str).expect("byte str decode")
ecdsa::Signature::from_str(hex_str).expect("byte str decode")
);
let sig = ecdsa::Signature::from_str(&hex_str).expect("byte str decode");
let sig = ecdsa::Signature::from_str(hex_str).expect("byte str decode");
assert_eq!(&sig.to_string(), hex_str);
assert_eq!(&format!("{:?}", sig), hex_str);
@ -759,7 +759,7 @@ mod tests {
// 71 byte signature
let hex_str = "30450221009d0bad576719d32ae76bedb34c774866673cbde3f4e12951555c9408e6ce774b02202876e7102f204f6bfee26c967c3926ce702cf97d4b010062e193f763190f6776";
let sig = ecdsa::Signature::from_str(&hex_str).expect("byte str decode");
let sig = ecdsa::Signature::from_str(hex_str).expect("byte str decode");
assert_eq!(&format!("{}", sig), hex_str);
}
@ -1026,7 +1026,7 @@ mod tests {
let msg = Message::from_slice(&msg_data).unwrap();
// Check usage as explicit parameter
let pk = PublicKey::from_secret_key(&SECP256K1, &sk);
let pk = PublicKey::from_secret_key(SECP256K1, &sk);
// Check usage as self
let sig = SECP256K1.sign_ecdsa(&msg, &sk);