@@ -216,15 +216,14 @@ pub fn resolve_with_previous<'cfg>(
216216    // 
217217    // TODO: this seems like a hokey reason to single out the registry as being 
218218    // 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 ( ) 
224222                . 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 ( ) ; 
228227
229228    let  pre_patch_keep = |p :  & PackageId | { 
230229        !to_avoid_sources. contains ( & p. source_id ( ) ) 
@@ -286,18 +285,23 @@ pub fn resolve_with_previous<'cfg>(
286285    // In the case where a previous instance of resolve is available, we 
287286    // want to lock as many packages as possible to the previous version 
288287    // without disturbing the graph structure. 
289-     let  mut  try_to_use = HashSet :: new ( ) ; 
290288    if  let  Some ( r)  = previous { 
291289        trace ! ( "previous: {:?}" ,  r) ; 
292290        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-         } ) ) ; 
300291    } 
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 ( ) ; 
301305
302306    if  register_patches { 
303307        registry. lock_patches ( ) ; 
0 commit comments