Skip to content

Commit

Permalink
Ident == AsRef<str>
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 18, 2018
1 parent 3d9d6ad commit c0bbcc5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,15 @@ impl PartialEq for Ident {
}
}

impl<T> PartialEq<T> for Ident
where
T: ?Sized + AsRef<str>,
{
fn eq(&self, other: &T) -> bool {
self.to_string() == other.as_ref()
}
}

impl Eq for Ident {}

impl PartialOrd for Ident {
Expand Down

0 comments on commit c0bbcc5

Please sign in to comment.