1
Fork 0

Replace unneeded unsafe calls to .get() with calls to .get_mut()

This commit is contained in:
Daniel Henry-Mantilla 2020-09-19 21:33:40 +02:00
parent 8169989507
commit 5886c38112
5 changed files with 7 additions and 16 deletions

View file

@ -406,9 +406,7 @@ impl<T: ?Sized> Mutex<T> {
/// ```
#[stable(feature = "mutex_get_mut", since = "1.6.0")]
pub fn get_mut(&mut self) -> LockResult<&mut T> {
// We know statically that there are no other references to `self`, so
// there's no need to lock the inner mutex.
let data = unsafe { &mut *self.data.get() };
let data = self.data.get_mut();
poison::map_result(self.poison.borrow(), |_| data)
}
}