diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-05-15 06:32:44 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-05-21 20:08:33 +1000 |
| commit | b557567c35cbb0c84c536e62df8dbfd1694314ef (patch) | |
| tree | f92ef3e577e65a78da9b998b1d5a63ad79872df6 /src/libsyntax_pos | |
| parent | d35181ad8785fa958e43580a29a982afe02c728f (diff) | |
| download | rust-b557567c35cbb0c84c536e62df8dbfd1694314ef.tar.gz rust-b557567c35cbb0c84c536e62df8dbfd1694314ef.zip | |
Remove impls for `InternedString`/string equality.
`Symbol` received the same treatment in #60630. Also, we can derive `PartialEq` for `InternedString`.
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 aa9028d4a6b..ed2edaef14e 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -1146,7 +1146,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, } @@ -1211,42 +1211,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)) |
