diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-07-24 16:43:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-24 16:43:45 -0600 |
| commit | dab595e96a9dee0b0f41e55504d2f69b0d4b5d6e (patch) | |
| tree | 5f4a98956776862d3c053ffc63af55269fb7ab68 | |
| parent | 06ba69d043efd5612aad2aa4903125d34eba17d4 (diff) | |
| parent | b1d2a91f3260b5ee045310f4eb28abd2c62773e1 (diff) | |
| download | rust-dab595e96a9dee0b0f41e55504d2f69b0d4b5d6e.tar.gz rust-dab595e96a9dee0b0f41e55504d2f69b0d4b5d6e.zip | |
Rollup merge of #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`.
| -rw-r--r-- | src/libcore/hash/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index e6f8dfffd63..e7907e03444 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -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 { |
