diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-22 03:47:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-22 03:47:41 +0200 |
| commit | 44cb86bdc84cbcd659838703150bf9739b65ffd2 (patch) | |
| tree | 3187e98ccee0b074e8c8e9b999e5195c060eb4da /src/libsyntax_pos | |
| parent | 98172092cf18f0b226008bce4e16c65dc5832cbf (diff) | |
| parent | b557567c35cbb0c84c536e62df8dbfd1694314ef (diff) | |
| download | rust-44cb86bdc84cbcd659838703150bf9739b65ffd2.tar.gz rust-44cb86bdc84cbcd659838703150bf9739b65ffd2.zip | |
Rollup merge of #61003 - nnethercote:rm-InternedString-PartialEq-impls, r=petrochenkov
Remove impls for `InternedString`/string equality. `Symbol` received the same treatment in #60630. Also, we can derive `PartialEq` for `InternedString`. r? @petrochenkov
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index e69a9a1c5cf..8b07e81e586 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -1147,7 +1147,7 @@ impl Encodable for LocalInternedString { /// assert_ne!(Symbol::gensym("x"), Symbol::gensym("x")) /// assert_eq!(Symbol::gensym("x").as_interned_str(), Symbol::gensym("x").as_interned_str()) /// ``` -#[derive(Clone, Copy, Eq)] +#[derive(Clone, Copy, PartialEq, Eq)] pub struct InternedString { symbol: Symbol, } @@ -1212,42 +1212,6 @@ impl Ord for InternedString { } } -impl<T: std::ops::Deref<Target = str>> PartialEq<T> for InternedString { - fn eq(&self, other: &T) -> bool { - self.with(|string| string == other.deref()) - } -} - -impl PartialEq<InternedString> for InternedString { - fn eq(&self, other: &InternedString) -> bool { - self.symbol == other.symbol - } -} - -impl PartialEq<InternedString> for str { - fn eq(&self, other: &InternedString) -> bool { - other.with(|string| self == string) - } -} - -impl<'a> PartialEq<InternedString> for &'a str { - fn eq(&self, other: &InternedString) -> bool { - other.with(|string| *self == string) - } -} - -impl PartialEq<InternedString> for String { - fn eq(&self, other: &InternedString) -> bool { - other.with(|string| self == string) - } -} - -impl<'a> PartialEq<InternedString> for &'a String { - fn eq(&self, other: &InternedString) -> bool { - other.with(|string| *self == string) - } -} - impl fmt::Debug for InternedString { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.with(|str| fmt::Debug::fmt(&str, f)) |
