Skip to content

Commit 69e5729

Browse files
Simplify the implementation of get_mut (no unsafe)
1 parent 5629309 commit 69e5729

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

library/core/src/cell.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1733,8 +1733,7 @@ impl<T: ?Sized> UnsafeCell<T> {
17331733
#[inline]
17341734
#[unstable(feature = "unsafe_cell_get_mut", issue = "76943")]
17351735
pub fn get_mut(&mut self) -> &mut T {
1736-
// SAFETY: (outer) `&mut` guarantees unique access.
1737-
unsafe { &mut *self.get() }
1736+
&mut self.value
17381737
}
17391738

17401739
/// Gets a mutable pointer to the wrapped value.

0 commit comments

Comments
 (0)