diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs index 30f0bdece..7feedc8b9 100644 --- a/tokio/src/sync/mutex.rs +++ b/tokio/src/sync/mutex.rs @@ -716,10 +716,7 @@ impl Mutex { /// } /// ``` pub fn get_mut(&mut self) -> &mut T { - unsafe { - // Safety: This is https://github.com/rust-lang/rust/pull/76936 - &mut *self.c.get() - } + self.c.get_mut() } /// Attempts to acquire the lock, and returns [`TryLockError`] if the lock diff --git a/tokio/src/sync/rwlock.rs b/tokio/src/sync/rwlock.rs index d94b65143..087c5b3da 100644 --- a/tokio/src/sync/rwlock.rs +++ b/tokio/src/sync/rwlock.rs @@ -1073,10 +1073,7 @@ impl RwLock { /// } /// ``` pub fn get_mut(&mut self) -> &mut T { - unsafe { - // Safety: This is https://github.com/rust-lang/rust/pull/76936 - &mut *self.c.get() - } + self.c.get_mut() } /// Consumes the lock, returning the underlying data.