diff --git a/src/sixty_four.rs b/src/sixty_four.rs index b13239ae8..c03a63efe 100644 --- a/src/sixty_four.rs +++ b/src/sixty_four.rs @@ -14,7 +14,7 @@ pub const PRIME_5: u64 = 2_870_177_450_012_600_261; #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, Eq, Hash, PartialEq)] struct XxCore { v1: u64, v2: u64, @@ -25,7 +25,7 @@ struct XxCore { /// Calculates the 64-bit hash. #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct XxHash64 { total_len: u64, seed: u64, @@ -124,7 +124,7 @@ impl core::fmt::Debug for XxCore { } #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] -#[derive(Debug, Copy, Clone, Default, PartialEq)] +#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)] #[repr(align(8))] #[cfg_attr(feature = "serialize", serde(transparent))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] @@ -132,7 +132,7 @@ struct AlignToU64(T); #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Debug, Copy, Clone, Default, PartialEq)] +#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)] struct Buffer { #[cfg_attr(feature = "serialize", serde(rename = "buffer"))] data: AlignToU64<[u8; CHUNK_SIZE]>, diff --git a/src/std_support.rs b/src/std_support.rs index a806e672f..7e40c609e 100644 --- a/src/std_support.rs +++ b/src/std_support.rs @@ -3,8 +3,8 @@ pub mod sixty_four { use core::hash::BuildHasher; use rand::{self, Rng}; - #[derive(Clone)] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] + #[derive(Clone, Debug, Eq, PartialEq, Hash)] /// Constructs a randomized seed and reuses it for multiple hasher instances. pub struct RandomXxHashBuilder64(u64); @@ -34,8 +34,8 @@ pub mod thirty_two { use core::hash::BuildHasher; use rand::{self, Rng}; - #[derive(Clone)] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] + #[derive(Clone, Debug, Eq, PartialEq, Hash)] /// Constructs a randomized seed and reuses it for multiple hasher instances. See the usage warning on `XxHash32`. pub struct RandomXxHashBuilder32(u32); @@ -65,8 +65,8 @@ pub mod xxh3 { use core::hash::BuildHasher; use rand::{self, Rng}; - #[derive(Clone)] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] + #[derive(Clone, Debug, Eq, PartialEq, Hash)] /// Constructs a randomized seed and reuses it for multiple hasher instances. pub struct RandomHashBuilder64(u64); @@ -90,8 +90,8 @@ pub mod xxh3 { } } - #[derive(Clone)] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] + #[derive(Clone, Debug, Eq, PartialEq, Hash)] /// Constructs a randomized seed and reuses it for multiple hasher instances. pub struct RandomHashBuilder128(u64); diff --git a/src/thirty_two.rs b/src/thirty_two.rs index daa74965f..cd3604b04 100644 --- a/src/thirty_two.rs +++ b/src/thirty_two.rs @@ -14,7 +14,7 @@ pub const PRIME_5: u32 = 374_761_393; #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] struct XxCore { v1: u32, v2: u32, @@ -30,7 +30,7 @@ struct XxCore { /// unlikely to be correct to use this in places like a `HashMap`. #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct XxHash32 { total_len: u64, seed: u32, @@ -114,7 +114,7 @@ impl core::fmt::Debug for XxCore { } #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] -#[derive(Debug, Copy, Clone, Default, PartialEq)] +#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)] #[repr(align(4))] #[cfg_attr(feature = "serialize", serde(transparent))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] @@ -122,7 +122,7 @@ struct AlignToU32(T); #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Debug, Copy, Clone, Default, PartialEq)] +#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)] struct Buffer { #[cfg_attr(feature = "serialize", serde(rename = "buffer"))] data: AlignToU32<[u8; CHUNK_SIZE]>, diff --git a/src/xxh3.rs b/src/xxh3.rs index 19d97d8d6..62ce10c38 100644 --- a/src/xxh3.rs +++ b/src/xxh3.rs @@ -117,7 +117,7 @@ pub fn hash128_with_secret(data: &[u8], secret: &[u8]) -> u128 { /// Calculates the 64-bit hash. #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Clone, Default)] +#[derive(Clone, Default, Eq, PartialEq, Debug)] pub struct Hash64(State); impl Hash64 { @@ -145,7 +145,7 @@ impl Hasher for Hash64 { /// Calculates the 128-bit hash. #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Clone, Default)] +#[derive(Clone, Default, Eq, PartialEq, Debug)] pub struct Hash128(State); impl Hash128 { @@ -204,8 +204,8 @@ const SECRET: Secret = Secret([ ]); #[repr(align(64))] -#[derive(Clone)] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] +#[derive(Clone, Eq, PartialEq, Debug)] struct Secret([u8; SECRET_DEFAULT_SIZE]); const_assert_eq!(mem::size_of::() % 16, 0); @@ -293,19 +293,19 @@ cfg_if! { #[repr(align(32))] #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] - #[derive(Clone)] + #[derive(Clone, Debug, Eq, PartialEq)] struct Acc([u64; ACC_NB]); } else if #[cfg(target_feature = "sse2")] { #[repr(align(16))] #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] - #[derive(Clone)] + #[derive(Clone, Debug, Eq, PartialEq)] struct Acc([u64; ACC_NB]); } else { #[repr(align(8))] #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] - #[derive(Clone)] + #[derive(Clone, Debug, Eq, PartialEq)] struct Acc([u64; ACC_NB]); } } @@ -856,7 +856,7 @@ const_assert_eq!(INTERNAL_BUFFER_SIZE % STRIPE_LEN, 0); #[repr(align(64))] #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Clone)] +#[derive(Clone, Eq, PartialEq, Debug)] struct State { acc: Acc, secret: With, @@ -868,7 +868,7 @@ struct State { #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[cfg_attr(feature = "mem_dbg", derive(mem_dbg::MemSize, mem_dbg::MemDbg))] -#[derive(Clone)] +#[derive(Clone, Debug, Eq, PartialEq)] enum With { Default(Secret), Custom(Secret),