Skip to content

Commit dab595e

Browse files
Rollup merge of rust-lang#52402 - crepererum:build_hasher_eq, r=sfackler
impl PartialEq+Eq for BuildHasherDefault `BuildHasherDefault`is only one way of implementing `BuildHasher`. Clearly, every `BuildHasherDefault` for the same type `H` is identical, since it just uses `Default<H>` to construct `H`. In general, this is not true for every `BuildHasher`, so I think it is helpful to implement `PartialEq` and `Eq`.
2 parents 06ba69d + b1d2a91 commit dab595e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/hash/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,16 @@ impl<H> Default for BuildHasherDefault<H> {
542542
}
543543
}
544544

545+
#[stable(since = "1.29.0", feature = "build_hasher_eq")]
546+
impl<H> PartialEq for BuildHasherDefault<H> {
547+
fn eq(&self, _other: &BuildHasherDefault<H>) -> bool {
548+
true
549+
}
550+
}
551+
552+
#[stable(since = "1.29.0", feature = "build_hasher_eq")]
553+
impl<H> Eq for BuildHasherDefault<H> {}
554+
545555
//////////////////////////////////////////////////////////////////////////////
546556

547557
mod impls {

0 commit comments

Comments
 (0)