This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Commit 0616c78 1 parent 7863ee6 commit 0616c78 Copy full SHA for 0616c78
File tree 2 files changed +12
-13
lines changed
primitives/trie/src/cache
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ mod tests {
586
586
587
587
// Check that all items are there.
588
588
assert ! ( shared_cache
589
- . read_lock_inner( )
589
+ . read_lock_inner( )
590
590
. value_cache( )
591
591
. lru
592
592
. iter( )
@@ -606,7 +606,7 @@ mod tests {
606
606
607
607
// Ensure that the accessed items are most recently used items of the shared value cache.
608
608
assert ! ( shared_cache
609
- . read_lock_inner( )
609
+ . read_lock_inner( )
610
610
. value_cache( )
611
611
. lru
612
612
. iter( )
Original file line number Diff line number Diff line change @@ -78,17 +78,16 @@ impl<H: AsRef<[u8]> + Eq + std::hash::Hash> SharedNodeCache<H> {
78
78
added : impl IntoIterator < Item = ( H , NodeOwned < H > ) > ,
79
79
accessed : impl IntoIterator < Item = H > ,
80
80
) {
81
- let update_size_in_bytes =
82
- |size_in_bytes : & mut usize , key : & H , node : & NodeOwned < H > | {
83
- if let Some ( new_size_in_bytes) =
84
- size_in_bytes. checked_sub ( key. as_ref ( ) . len ( ) + node. size_in_bytes ( ) )
85
- {
86
- * size_in_bytes = new_size_in_bytes;
87
- } else {
88
- * size_in_bytes = 0 ;
89
- tracing:: error!( target: LOG_TARGET , "`SharedNodeCache` underflow detected!" , ) ;
90
- }
91
- } ;
81
+ let update_size_in_bytes = |size_in_bytes : & mut usize , key : & H , node : & NodeOwned < H > | {
82
+ if let Some ( new_size_in_bytes) =
83
+ size_in_bytes. checked_sub ( key. as_ref ( ) . len ( ) + node. size_in_bytes ( ) )
84
+ {
85
+ * size_in_bytes = new_size_in_bytes;
86
+ } else {
87
+ * size_in_bytes = 0 ;
88
+ tracing:: error!( target: LOG_TARGET , "`SharedNodeCache` underflow detected!" , ) ;
89
+ }
90
+ } ;
92
91
93
92
accessed. into_iter ( ) . for_each ( |key| {
94
93
// Access every node in the lru to put it to the front.
You can’t perform that action at this time.
0 commit comments