diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 7bf32cb0d98f2..e31de08f7622b 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -381,9 +381,6 @@ impl Cell { #[inline] #[stable(feature = "move_cell", since = "1.17.0")] pub fn swap(&self, other: &Self) { - if ptr::eq(self, other) { - return; - } // SAFETY: This can be risky if called from separate threads, but `Cell` // is `!Sync` so this won't happen. This also won't invalidate any // pointers since `Cell` makes sure nothing else will be pointing into