Implement `PartialEq<Builtin> for str/String`
MichaReiser opened this issue · 3 comments
MichaReiser commented
We should implement PartialEq<Builtin> for &str and PartialEq<Builtin> for String so that both ident == str and str == ident work.
youknowone commented
Isn't PartialEq<Identifier> for str enough?
That looks &ident == str and str == &ident will work.
Is str in the example is std::string::String?
MichaReiser commented
Isn't PartialEq for str enough?
I don't think it is. Implementing PartialEq<&str> for Identifier only gives you ident == str but not str == ident doc
Adding
PartialEqforStringis mainly a convenience. Rust also implementsstr == String, it would be nice ifIdentifiersallowStringcomparison too.
Is str in the example is std::string::String?
It's either a &str or std::string::String`
youknowone commented
Thank you! I got it.