about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/lazy.rs3
1 files changed, 1 insertions, 2 deletions
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<T> OnceCell<T> {
     /// 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`.