Rollup merge of #92427 - ChayimFriedman2:patch-1, r=kennytm
Use `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()` This removes one unnecessary `unsafe` block.
This commit is contained in:
commit
c10fe04484
1 changed files with 1 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue