Skip to content

Commit 7e4c0a0

Browse files
committed
Add str and &str partial equality
1 parent 90d7338 commit 7e4c0a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/libcore/str/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,22 @@ mod traits {
16081608
fn ne(&self, other: &str) -> bool { !(*self).eq(other) }
16091609
}
16101610

1611+
#[stable(feature = "rust1", since = "1.24.0")]
1612+
impl<'a> PartialEq<&'a str> for str {
1613+
#[inline]
1614+
fn eq(&self, other: &&'a str) -> bool { self == *other }
1615+
#[inline]
1616+
fn ne(&self, other: &&'a str) -> bool { self != *other }
1617+
}
1618+
1619+
#[stable(feature = "rust1", since = "1.24.0")]
1620+
impl<'a> PartialEq<str> for &'a str {
1621+
#[inline]
1622+
fn eq(&self, other: &str) -> bool { *self == other }
1623+
#[inline]
1624+
fn ne(&self, other: &str) -> bool { *self != other }
1625+
}
1626+
16111627
#[stable(feature = "rust1", since = "1.0.0")]
16121628
impl Eq for str {}
16131629

0 commit comments

Comments
 (0)