libcollections: DRY up a PartialEq impl for String
This commit is contained in:
parent
cc830ef18b
commit
f57621535e
1 changed files with 3 additions and 18 deletions
|
@ -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,24 +984,9 @@ 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]
|
||||
|
|
Loading…
Reference in a new issue