Skip to content

Commit

Permalink
Simplify the implementation of get_mut (no unsafe)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhenrymantilla committed Nov 4, 2020
1 parent 5629309 commit 69e5729
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,8 +1733,7 @@ impl<T: ?Sized> UnsafeCell<T> {
#[inline]
#[unstable(feature = "unsafe_cell_get_mut", issue = "76943")]
pub fn get_mut(&mut self) -> &mut T {
// SAFETY: (outer) `&mut` guarantees unique access.
unsafe { &mut *self.get() }
&mut self.value
}

/// Gets a mutable pointer to the wrapped value.
Expand Down

0 comments on commit 69e5729

Please sign in to comment.