File tree 2 files changed +8
-12
lines changed 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -328,6 +328,10 @@ impl Dependency {
328
328
}
329
329
330
330
pub fn set_kind ( & mut self , kind : Kind ) -> & mut Dependency {
331
+ if self . is_public ( ) {
332
+ // Setting 'public' only makes sense for normal dependencies
333
+ assert_eq ! ( kind, Kind :: Normal ) ;
334
+ }
331
335
Rc :: make_mut ( & mut self . inner ) . kind = kind;
332
336
self
333
337
}
Original file line number Diff line number Diff line change @@ -49,19 +49,11 @@ impl Resolve {
49
49
. map ( |p| {
50
50
let public_deps = graph
51
51
. edges ( p)
52
- . flat_map ( |( dep_package, deps) | {
53
- let id_opt: Option < PackageId > = deps
54
- . iter ( )
55
- . find ( |d| d. kind ( ) == Kind :: Normal )
56
- . and_then ( |d| {
57
- if d. is_public ( ) {
58
- Some ( * dep_package)
59
- } else {
60
- None
61
- }
62
- } ) ;
63
- id_opt
52
+ . filter ( |( _, deps) | {
53
+ deps. iter ( )
54
+ . any ( |d| d. kind ( ) == Kind :: Normal && d. is_public ( ) )
64
55
} )
56
+ . map ( |( dep_package, _) | * dep_package)
65
57
. collect :: < HashSet < PackageId > > ( ) ;
66
58
67
59
( * p, public_deps)
You can’t perform that action at this time.
0 commit comments