servo_arc: Make Arc do a pointer equality check in eq and ne first.

This commit is contained in:
Cameron McCormack 2017-10-09 16:57:49 +08:00
parent 715fc9cea6
commit 9c738711bc

View file

@ -389,11 +389,11 @@ impl<T: ?Sized> Drop for Arc<T> {
impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
fn eq(&self, other: &Arc<T>) -> bool {
*(*self) == *(*other)
Self::ptr_eq(self, other) || *(*self) == *(*other)
}
fn ne(&self, other: &Arc<T>) -> bool {
*(*self) != *(*other)
!Self::ptr_eq(self, other) && *(*self) != *(*other)
}
}
impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {