use mem::swap instead of ptr::swap_nonoverlapping

This commit is contained in:
Ralf Jung 2023-08-16 08:47:06 +02:00
parent 26cfd211fb
commit e7a1e4271d

View file

@ -450,7 +450,7 @@ impl<T> Cell<T> {
// either of these `Cell`s. We also excluded shenanigans like partially overlapping `Cell`s,
// so `swap` will just properly copy two full values of type `T` back and forth.
unsafe {
ptr::swap_nonoverlapping(self.value.get(), other.value.get(), 1);
mem::swap(&mut *self.value.get(), &mut *other.value.get());
}
}