add a test for the memo hook

This commit is contained in:
Evan Almloff committed 2024-03-11 15:33:46 -05:00
1 parent bbc81b8f9c
commit f51b5617e1
6 files changed
+115 -31

No files matched your search

+1 -9
View File
@@ -145,15 +145,7 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
at: crate::GenerationalRefMutBorrowInfo,
) -> Result<Self::Mut<'static, T>, error::BorrowMutError> {
let write = self.0.try_write();
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
let write = write.ok_or_else(|| at.borrowed_from.borrow_mut_error())?;
#[cfg(not(any(debug_assertions, feature = "debug_ownership")))]
let write = write.ok_or_else(|| {
error::BorrowMutError::AlreadyBorrowed(error::AlreadyBorrowedError {})
})?;
let write = self.0.write();
RwLockWriteGuard::try_map(write, |any| any.as_mut()?.downcast_mut())
.map_err(|_| {