@@ -216,15 +216,14 @@ pub fn resolve_with_previous<'cfg>(
216
216
//
217
217
// TODO: this seems like a hokey reason to single out the registry as being
218
218
// different.
219
- let mut to_avoid_sources: HashSet < SourceId > = HashSet :: new ( ) ;
220
- if let Some ( to_avoid) = to_avoid {
221
- to_avoid_sources. extend (
222
- to_avoid
223
- . iter ( )
219
+ let to_avoid_sources: HashSet < SourceId > = to_avoid
220
+ . map ( |set| {
221
+ set. iter ( )
224
222
. map ( |p| p. source_id ( ) )
225
- . filter ( |s| !s. is_registry ( ) ) ,
226
- ) ;
227
- }
223
+ . filter ( |s| !s. is_registry ( ) )
224
+ . collect ( )
225
+ } )
226
+ . unwrap_or_default ( ) ;
228
227
229
228
let pre_patch_keep = |p : & PackageId | {
230
229
!to_avoid_sources. contains ( & p. source_id ( ) )
@@ -286,18 +285,23 @@ pub fn resolve_with_previous<'cfg>(
286
285
// In the case where a previous instance of resolve is available, we
287
286
// want to lock as many packages as possible to the previous version
288
287
// without disturbing the graph structure.
289
- let mut try_to_use = HashSet :: new ( ) ;
290
288
if let Some ( r) = previous {
291
289
trace ! ( "previous: {:?}" , r) ;
292
290
register_previous_locks ( ws, registry, r, & keep) ;
293
-
294
- // Everything in the previous lock file we want to keep is prioritized
295
- // in dependency selection if it comes up, aka we want to have
296
- // conservative updates.
297
- try_to_use. extend ( r. iter ( ) . filter ( keep) . inspect ( |id| {
298
- debug ! ( "attempting to prefer {}" , id) ;
299
- } ) ) ;
300
291
}
292
+ // Everything in the previous lock file we want to keep is prioritized
293
+ // in dependency selection if it comes up, aka we want to have
294
+ // conservative updates.
295
+ let try_to_use = previous
296
+ . map ( |r| {
297
+ r. iter ( )
298
+ . filter ( keep)
299
+ . inspect ( |id| {
300
+ debug ! ( "attempting to prefer {}" , id) ;
301
+ } )
302
+ . collect ( )
303
+ } )
304
+ . unwrap_or_default ( ) ;
301
305
302
306
if register_patches {
303
307
registry. lock_patches ( ) ;
0 commit comments