@@ -435,7 +435,7 @@ impl<T: ?Sized + ListItem<ID>, const ID: u64> List<T, ID> {
435
435
// * If `item` was the only item in the list, then `prev == item`, and we just set
436
436
// `item->next` to null, so this correctly sets `first` to null now that the list is
437
437
// empty.
438
- if self . first == item {
438
+ if core :: ptr :: eq ( self . first , item) {
439
439
// SAFETY: The `prev` pointer is the value that `item->prev` had when it was in this
440
440
// list, so it must be valid. There is no race since `prev` is still in the list and we
441
441
// still have exclusive access to the list.
@@ -556,7 +556,7 @@ impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Iterator for Iter<'a, T, ID> {
556
556
let next = unsafe { ( * current) . next } ;
557
557
// INVARIANT: If `current` was the last element of the list, then this updates it to null.
558
558
// Otherwise, we update it to the next element.
559
- self . current = if next != self . stop {
559
+ self . current = if !core :: ptr :: eq ( next, self . stop ) {
560
560
next
561
561
} else {
562
562
ptr:: null_mut ( )
@@ -726,7 +726,7 @@ impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Cursor<'a, T, ID> {
726
726
fn prev_ptr ( & self ) -> * mut ListLinksFields {
727
727
let mut next = self . next ;
728
728
let first = self . list . first ;
729
- if next == first {
729
+ if core :: ptr :: eq ( next, first) {
730
730
// We are before the first element.
731
731
return core:: ptr:: null_mut ( ) ;
732
732
}
@@ -788,7 +788,7 @@ impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Cursor<'a, T, ID> {
788
788
// access the `next` field.
789
789
let mut next = unsafe { ( * self . next ) . next } ;
790
790
791
- if next == self . list . first {
791
+ if core :: ptr :: eq ( next, self . list . first ) {
792
792
next = core:: ptr:: null_mut ( ) ;
793
793
}
794
794
@@ -802,7 +802,7 @@ impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Cursor<'a, T, ID> {
802
802
/// If the cursor is before the first element, then this call does nothing. This call returns
803
803
/// `true` if the cursor's position was changed.
804
804
pub fn move_prev ( & mut self ) -> bool {
805
- if self . next == self . list . first {
805
+ if core :: ptr :: eq ( self . next , self . list . first ) {
806
806
return false ;
807
807
}
808
808
@@ -822,7 +822,7 @@ impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Cursor<'a, T, ID> {
822
822
// * `ptr` is an element in the list or null.
823
823
// * if `ptr` is null, then `self.list.first` is null so the list is empty.
824
824
let item = unsafe { self . list . insert_inner ( item, ptr) } ;
825
- if self . next == self . list . first {
825
+ if core :: ptr :: eq ( self . next , self . list . first ) {
826
826
// INVARIANT: We just inserted `item`, so it's a member of list.
827
827
self . list . first = item;
828
828
}
0 commit comments