Skip to content

Commit

Permalink
Rollup merge of rust-lang#52402 - crepererum:build_hasher_eq, r=sfackler
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
Mark-Simulacrum authored Jul 24, 2018
2 parents 06ba69d + b1d2a91 commit dab595e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,16 @@ impl<H> Default for BuildHasherDefault<H> {
}
}

#[stable(since = "1.29.0", feature = "build_hasher_eq")]
impl<H> PartialEq for BuildHasherDefault<H> {
fn eq(&self, _other: &BuildHasherDefault<H>) -> bool {
true
}
}

#[stable(since = "1.29.0", feature = "build_hasher_eq")]
impl<H> Eq for BuildHasherDefault<H> {}

//////////////////////////////////////////////////////////////////////////////

mod impls {
Expand Down

0 comments on commit dab595e

Please sign in to comment.