Address comments

This commit is contained in:
Robin Raymond 2022-05-13 07:18:57 +00:00
parent 391f800705
commit cf1238e799

View File

@ -101,8 +101,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[clippy::has_significant_drop] #[clippy::has_significant_drop]
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
data: *const T,
inner_lock: &'a sys::MovableRwLock, inner_lock: &'a sys::MovableRwLock,
data: &'a T,
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -513,7 +513,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockReadGuard<'rwlock, T>> { unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockReadGuard<'rwlock, T>> {
poison::map_result(lock.poison.borrow(), |()| RwLockReadGuard { poison::map_result(lock.poison.borrow(), |()| RwLockReadGuard {
inner_lock: &lock.inner, inner_lock: &lock.inner,
data: &*lock.data.get(), data: lock.data.get(),
}) })
} }
} }
@ -557,7 +557,7 @@ impl<T: ?Sized> Deref for RwLockReadGuard<'_, T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { fn deref(&self) -> &T {
self.data unsafe { &*self.data }
} }
} }