File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ impl Source {
89
89
matches ! ( self , Source :: Git { .. } | Source :: Url { .. } )
90
90
}
91
91
92
+ pub fn is_repo ( & self ) -> bool {
93
+ matches ! ( self , Source :: Repository { .. } )
94
+ }
95
+
92
96
/// The key to use in the cache: URL for a package repository, git URL for a git repository
93
97
/// and for local the actual path
94
98
pub fn source_path ( & self ) -> & str {
Original file line number Diff line number Diff line change @@ -503,6 +503,12 @@ impl<'d> Resolver<'d> {
503
503
None
504
504
| Some ( ConfigDependency :: Detailed { .. } )
505
505
| Some ( ConfigDependency :: Simple ( _) ) => {
506
+ // If we already have something that will satisfy the dependency, no need
507
+ // to look it up again
508
+ if item. version_requirement . is_none ( ) && result. found_in_repo ( & item. name ) {
509
+ continue ;
510
+ }
511
+
506
512
if let Some ( ( resolved_dep, items) ) = self . repositories_lookup ( & item, cache) {
507
513
result. add_found ( resolved_dep) ;
508
514
queue. extend ( items) ;
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ impl<'d> Resolution<'d> {
32
32
self . found . push ( dep) ;
33
33
}
34
34
35
+ /// If we already found something matching, we skip trying to get it.
36
+ /// This is only called when we would look up a repo for a package without a version requirement
37
+ pub ( crate ) fn found_in_repo ( & self , name : & str ) -> bool {
38
+ self . found
39
+ . iter ( )
40
+ . find ( |d| d. source . is_repo ( ) && d. name == name)
41
+ . is_some ( )
42
+ }
43
+
35
44
pub fn finalize ( & mut self ) {
36
45
let mut solver = DependencySolver :: default ( ) ;
37
46
for package in & self . found {
You can’t perform that action at this time.
0 commit comments