@@ -49,12 +49,11 @@ pub trait QueryCache: QueryStorage {
4949 index : DepNodeIndex ,
5050 ) -> Self :: Stored ;
5151
52- fn iter < R , L > (
52+ fn iter < R > (
5353 & self ,
54- shards : & Sharded < L > ,
55- get_shard : impl Fn ( & mut L ) -> & mut Self :: Sharded ,
54+ shards : & Sharded < Self :: Sharded > ,
5655 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 ) > ,
5857 ) -> R ,
5958 ) -> R ;
6059}
@@ -125,16 +124,14 @@ where
125124 value
126125 }
127126
128- fn iter < R , L > (
127+ fn iter < R > (
129128 & 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 ,
133131 ) -> 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)
138135 }
139136}
140137
@@ -210,15 +207,13 @@ where
210207 & value. 0
211208 }
212209
213- fn iter < R , L > (
210+ fn iter < R > (
214211 & 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 ,
218214 ) -> 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)
223218 }
224219}
0 commit comments