diff --git a/library/core/src/lazy.rs b/library/core/src/lazy.rs index 2b8a5f3cbf3..788f0cce01b 100644 --- a/library/core/src/lazy.rs +++ b/library/core/src/lazy.rs @@ -102,8 +102,7 @@ impl OnceCell { /// Returns `None` if the cell is empty. #[unstable(feature = "once_cell", issue = "74465")] pub fn get_mut(&mut self) -> Option<&mut T> { - // SAFETY: Safe because we have unique access - unsafe { &mut *self.inner.get() }.as_mut() + self.inner.get_mut().as_mut() } /// Sets the contents of the cell to `value`.