mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-22 11:53:44 +00:00
Use UnsafeCell::get_mut()
in core::lazy::OnceCell::get_mut()
This removes one unnecessary `unsafe` block.
This commit is contained in:
parent
d331cb710f
commit
e86ecdf9fe
@ -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`.
|
||||
|
Loading…
Reference in New Issue
Block a user