File tree 1 file changed +17
-12
lines changed
src/cargo/core/compiler/build_context 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -261,16 +261,21 @@ impl TargetInfo {
261
261
res
262
262
} ;
263
263
264
- let cfg = lines
265
- . map ( |line| Ok ( Cfg :: from_str ( line) ?) )
266
- . filter ( TargetInfo :: not_user_specific_cfg)
267
- . collect :: < CargoResult < Vec < _ > > > ( )
268
- . with_context ( || {
269
- format ! (
270
- "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
271
- output
272
- )
273
- } ) ?;
264
+ let cfg = {
265
+ let mut res = Vec :: new ( ) ;
266
+ for line in & mut lines {
267
+ let cfg = Cfg :: from_str ( line) . with_context ( || {
268
+ format ! (
269
+ "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
270
+ output
271
+ )
272
+ } ) ?;
273
+ if TargetInfo :: not_user_specific_cfg ( & cfg) {
274
+ res. push ( cfg) ;
275
+ }
276
+ }
277
+ res
278
+ } ;
274
279
275
280
// recalculate `rustflags` from above now that we have `cfg`
276
281
// information
@@ -362,8 +367,8 @@ impl TargetInfo {
362
367
}
363
368
}
364
369
365
- fn not_user_specific_cfg ( cfg : & CargoResult < Cfg > ) -> bool {
366
- if let Ok ( Cfg :: Name ( cfg_name) ) = cfg {
370
+ fn not_user_specific_cfg ( cfg : & Cfg ) -> bool {
371
+ if let Cfg :: Name ( cfg_name) = cfg {
367
372
// This should also include "debug_assertions", but it causes
368
373
// regressions. Maybe some day in the distant future it can be
369
374
// added (and possibly change the warning to an error).
You can’t perform that action at this time.
0 commit comments