File tree Expand file tree Collapse file tree 1 file changed +14
-19
lines changed Expand file tree Collapse file tree 1 file changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -170,28 +170,23 @@ pub fn check_implicit_features(
170
170
}
171
171
172
172
let manifest = pkg. manifest ( ) ;
173
- let user_defined_features = manifest. resolved_toml ( ) . features ( ) ;
174
- let features = user_defined_features. map_or ( HashSet :: new ( ) , |f| {
175
- f. keys ( ) . map ( |k| InternedString :: new ( & k) ) . collect ( )
176
- } ) ;
177
- // Add implicit features for optional dependencies if they weren't
178
- // explicitly listed anywhere.
179
- let explicitly_listed = user_defined_features. map_or ( HashSet :: new ( ) , |f| {
180
- f. values ( )
181
- . flatten ( )
182
- . filter_map ( |v| match FeatureValue :: new ( v. into ( ) ) {
183
- Dep { dep_name } => Some ( dep_name) ,
184
- _ => None ,
185
- } )
186
- . collect ( )
187
- } ) ;
173
+ let activated_opt_deps = manifest
174
+ . resolved_toml ( )
175
+ . features ( )
176
+ . map ( |map| {
177
+ map. values ( )
178
+ . flatten ( )
179
+ . filter_map ( |f| match FeatureValue :: new ( InternedString :: new ( f) ) {
180
+ Dep { dep_name } => Some ( dep_name. as_str ( ) ) ,
181
+ _ => None ,
182
+ } )
183
+ . collect :: < HashSet < _ > > ( )
184
+ } )
185
+ . unwrap_or_default ( ) ;
188
186
189
187
for dep in manifest. dependencies ( ) {
190
188
let dep_name_in_toml = dep. name_in_toml ( ) ;
191
- if !dep. is_optional ( )
192
- || features. contains ( & dep_name_in_toml)
193
- || explicitly_listed. contains ( & dep_name_in_toml)
194
- {
189
+ if !dep. is_optional ( ) || activated_opt_deps. contains ( dep_name_in_toml. as_str ( ) ) {
195
190
continue ;
196
191
}
197
192
if lint_level == LintLevel :: Forbid || lint_level == LintLevel :: Deny {
You can’t perform that action at this time.
0 commit comments