Skip to content

Commit

Permalink
Implement PartialEq between &str and OsString
Browse files Browse the repository at this point in the history
Allows for example `os_string == "something"`
  • Loading branch information
GabrielMajeri committed Jun 29, 2018
1 parent 6e5e63a commit 0250302
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,20 @@ impl PartialEq<OsString> for str {
}
}

#[stable(feature = "rust1", since = "1.28.0")]
impl<'a> PartialEq<&'a str> for OsString {
fn eq(&self, other: &&'a str) -> bool {
**self == **other
}
}

#[stable(feature = "rust1", since = "1.28.0")]
impl<'a> PartialEq<OsString> for &'a str {
fn eq(&self, other: &OsString) -> bool {
**other == **self
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Eq for OsString {}

Expand Down

0 comments on commit 0250302

Please sign in to comment.