In this post, we will see how to resolve why does rust allow comparison between &String and string slice?
PartialEq<str>is implemented for
String, so you can compare
str, and there is a blanket implementation
<A: PartialEq<B>> PartialEq<&B> for &A, so you can also compare
This is not related to deref coercion, as it does not apply to operators.
If you have better answer, please add a comment about this, thank you!