@@ -49,12 +49,11 @@ pub trait QueryCache: QueryStorage {
49
49
index : DepNodeIndex ,
50
50
) -> Self :: Stored ;
51
51
52
- fn iter < R , L > (
52
+ fn iter < R > (
53
53
& self ,
54
- shards : & Sharded < L > ,
55
- get_shard : impl Fn ( & mut L ) -> & mut Self :: Sharded ,
54
+ shards : & Sharded < Self :: Sharded > ,
56
55
f : impl for < ' a > FnOnce (
57
- Box < dyn Iterator < Item = ( & ' a Self :: Key , & ' a Self :: Value , DepNodeIndex ) > + ' a > ,
56
+ & ' a mut dyn Iterator < Item = ( & ' a Self :: Key , & ' a Self :: Value , DepNodeIndex ) > ,
58
57
) -> R ,
59
58
) -> R ;
60
59
}
@@ -125,16 +124,14 @@ where
125
124
value
126
125
}
127
126
128
- fn iter < R , L > (
127
+ fn iter < R > (
129
128
& self ,
130
- shards : & Sharded < L > ,
131
- get_shard : impl Fn ( & mut L ) -> & mut Self :: Sharded ,
132
- f : impl for < ' a > FnOnce ( Box < dyn Iterator < Item = ( & ' a K , & ' a V , DepNodeIndex ) > + ' a > ) -> R ,
129
+ shards : & Sharded < Self :: Sharded > ,
130
+ f : impl for < ' a > FnOnce ( & ' a mut dyn Iterator < Item = ( & ' a K , & ' a V , DepNodeIndex ) > ) -> R ,
133
131
) -> R {
134
- let mut shards = shards. lock_shards ( ) ;
135
- let mut shards: Vec < _ > = shards. iter_mut ( ) . map ( |shard| get_shard ( shard) ) . collect ( ) ;
136
- let results = shards. iter_mut ( ) . flat_map ( |shard| shard. iter ( ) ) . map ( |( k, v) | ( k, & v. 0 , v. 1 ) ) ;
137
- f ( Box :: new ( results) )
132
+ let shards = shards. lock_shards ( ) ;
133
+ let mut results = shards. iter ( ) . flat_map ( |shard| shard. iter ( ) ) . map ( |( k, v) | ( k, & v. 0 , v. 1 ) ) ;
134
+ f ( & mut results)
138
135
}
139
136
}
140
137
@@ -210,15 +207,13 @@ where
210
207
& value. 0
211
208
}
212
209
213
- fn iter < R , L > (
210
+ fn iter < R > (
214
211
& self ,
215
- shards : & Sharded < L > ,
216
- get_shard : impl Fn ( & mut L ) -> & mut Self :: Sharded ,
217
- f : impl for < ' a > FnOnce ( Box < dyn Iterator < Item = ( & ' a K , & ' a V , DepNodeIndex ) > + ' a > ) -> R ,
212
+ shards : & Sharded < Self :: Sharded > ,
213
+ f : impl for < ' a > FnOnce ( & ' a mut dyn Iterator < Item = ( & ' a K , & ' a V , DepNodeIndex ) > ) -> R ,
218
214
) -> R {
219
- let mut shards = shards. lock_shards ( ) ;
220
- let mut shards: Vec < _ > = shards. iter_mut ( ) . map ( |shard| get_shard ( shard) ) . collect ( ) ;
221
- let results = shards. iter_mut ( ) . flat_map ( |shard| shard. iter ( ) ) . map ( |( k, v) | ( k, & v. 0 , v. 1 ) ) ;
222
- f ( Box :: new ( results) )
215
+ let shards = shards. lock_shards ( ) ;
216
+ let mut results = shards. iter ( ) . flat_map ( |shard| shard. iter ( ) ) . map ( |( k, v) | ( k, & v. 0 , v. 1 ) ) ;
217
+ f ( & mut results)
223
218
}
224
219
}
0 commit comments