@@ -81,6 +81,9 @@ use anyhow::Context as _;
81
81
use std:: collections:: { HashMap , HashSet } ;
82
82
use tracing:: { debug, trace} ;
83
83
84
+ /// Filter for keep using Package ID from previous lockfile.
85
+ type Keep < ' a > = & ' a dyn Fn ( & PackageId ) -> bool ;
86
+
84
87
/// Result for `resolve_ws_with_opts`.
85
88
pub struct WorkspaceResolve < ' gctx > {
86
89
/// Packages to be downloaded.
@@ -317,7 +320,7 @@ pub fn resolve_with_previous<'gctx>(
317
320
cli_features : & CliFeatures ,
318
321
has_dev_units : HasDevUnits ,
319
322
previous : Option < & Resolve > ,
320
- keep_previous : Option < & dyn Fn ( & PackageId ) -> bool > ,
323
+ keep_previous : Option < Keep < ' _ > > ,
321
324
specs : & [ PackageIdSpec ] ,
322
325
register_patches : bool ,
323
326
) -> CargoResult < Resolve > {
@@ -492,7 +495,7 @@ fn register_previous_locks(
492
495
ws : & Workspace < ' _ > ,
493
496
registry : & mut PackageRegistry < ' _ > ,
494
497
resolve : & Resolve ,
495
- keep : & dyn Fn ( & PackageId ) -> bool ,
498
+ keep : Keep < ' _ > ,
496
499
dev_deps : bool ,
497
500
) {
498
501
let path_pkg = |id : SourceId | {
@@ -789,7 +792,7 @@ fn register_patch_entries(
789
792
ws : & Workspace < ' _ > ,
790
793
previous : Option < & Resolve > ,
791
794
version_prefs : & mut VersionPreferences ,
792
- keep_previous : & dyn Fn ( & PackageId ) -> bool ,
795
+ keep_previous : Keep < ' _ > ,
793
796
) -> CargoResult < HashSet < PackageId > > {
794
797
let mut avoid_patch_ids = HashSet :: new ( ) ;
795
798
for ( url, patches) in ws. root_patch ( ) ?. iter ( ) {
@@ -900,7 +903,7 @@ fn register_patch_entries(
900
903
fn lock_replacements (
901
904
ws : & Workspace < ' _ > ,
902
905
previous : Option < & Resolve > ,
903
- keep : & dyn Fn ( & PackageId ) -> bool ,
906
+ keep : Keep < ' _ > ,
904
907
) -> Vec < ( PackageIdSpec , Dependency ) > {
905
908
let root_replace = ws. root_replace ( ) ;
906
909
let replace = match previous {
0 commit comments