Manually impl PartialEq for bls::PublicKey

To fix: https://rust-lang.github.io/rust-clippy/master/#derive_hash_xor_eq
This commit is contained in:
Paul Hauner 2019-01-21 18:28:33 +11:00
parent fc5bcb88fb
commit 5a45093156

View File

@ -7,7 +7,7 @@ use std::hash::{Hash, Hasher};
/// ///
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ /// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
/// serialization). /// serialization).
#[derive(Debug, PartialEq, Clone, Eq)] #[derive(Debug, Clone, Eq)]
pub struct PublicKey(RawPublicKey); pub struct PublicKey(RawPublicKey);
impl PublicKey { impl PublicKey {
@ -35,6 +35,12 @@ impl Decodable for PublicKey {
} }
} }
impl PartialEq for PublicKey {
fn eq(&self, other: &PublicKey) -> bool {
ssz_encode(self) == ssz_encode(other)
}
}
impl Hash for PublicKey { impl Hash for PublicKey {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
ssz_encode(self).hash(state) ssz_encode(self).hash(state)