Closed
Description
It would be useful to be able to compare Option<T>
with Option<U>
if T
and U
are comparable themselves. I.e.
impl<A, B> PartialEq<Option<B>> for Option<A> where A: PartialEq<B> { ... }
assert!(Some(String::from_str("str")) == Some("str"))
Heterogeneous comparisons for Option
are clear and unambiguous and there are precedents - some other basic library types, like Vec
or [T]
support heterogeneous comparisons too.
cc @aturon
cc rust-lang/rust#22838