Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getmut, r=RalfJung

Simplify the implementation of `get_mut` (no unsafe)

Quick PR to reduce one use of `unsafe` pointed out in the previous PR

r? ````@RalfJung````
This commit is contained in:
Mara Bos 2020-11-05 10:29:54 +01:00 committed by GitHub
commit 29fad213b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.