about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Butler <haqkrs@gmail.com>2015-11-03 04:54:32 +0000
committerKevin Butler <haqkrs@gmail.com>2015-11-03 17:41:42 +0000
commitf57621535efc5b68d883ef51dc3b324e9ab3d83f (patch)
tree2ff9934a38c4cd0cb6656d068d6318b16a8a5e80
parentcc830ef18b3014158715f0fd5635a179c5bd7844 (diff)
libcollections: DRY up a PartialEq impl for String
-rw-r--r--src/libcollections/string.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 96a28d3ee3b..8d07e2b2018 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -963,7 +963,7 @@ impl PartialEq for String {
 macro_rules! impl_eq {
     ($lhs:ty, $rhs: ty) => {
         #[stable(feature = "rust1", since = "1.0.0")]
-        impl<'a> PartialEq<$rhs> for $lhs {
+        impl<'a, 'b> PartialEq<$rhs> for $lhs {
             #[inline]
             fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&self[..], &other[..]) }
             #[inline]
@@ -971,7 +971,7 @@ macro_rules! impl_eq {
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
-        impl<'a> PartialEq<$lhs> for $rhs {
+        impl<'a, 'b> PartialEq<$lhs> for $rhs {
             #[inline]
             fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&self[..], &other[..]) }
             #[inline]
@@ -984,25 +984,10 @@ macro_rules! impl_eq {
 impl_eq! { String, str }
 impl_eq! { String, &'a str }
 impl_eq! { Cow<'a, str>, str }
+impl_eq! { Cow<'a, str>, &'b str }
 impl_eq! { Cow<'a, str>, String }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, 'b> PartialEq<&'b str> for Cow<'a, str> {
-    #[inline]
-    fn eq(&self, other: &&'b str) -> bool { PartialEq::eq(&self[..], &other[..]) }
-    #[inline]
-    fn ne(&self, other: &&'b str) -> bool { PartialEq::ne(&self[..], &other[..]) }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b str {
-    #[inline]
-    fn eq(&self, other: &Cow<'a, str>) -> bool { PartialEq::eq(&self[..], &other[..]) }
-    #[inline]
-    fn ne(&self, other: &Cow<'a, str>) -> bool { PartialEq::ne(&self[..], &other[..]) }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
 impl Default for String {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]