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.
|
/// Returns `None` if the cell is empty.
|
||||||
#[unstable(feature = "once_cell", issue = "74465")]
|
#[unstable(feature = "once_cell", issue = "74465")]
|
||||||
pub fn get_mut(&mut self) -> Option<&mut T> {
|
pub fn get_mut(&mut self) -> Option<&mut T> {
|
||||||
// SAFETY: Safe because we have unique access
|
self.inner.get_mut().as_mut()
|
||||||
unsafe { &mut *self.inner.get() }.as_mut()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the contents of the cell to `value`.
|
/// Sets the contents of the cell to `value`.
|
||||||
|
|
Loading…
Reference in a new issue