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 @@ -255,16 +255,21 @@ impl TargetInfo {
255
255
res
256
256
} ;
257
257
258
- let cfg = lines
259
- . map ( |line| Ok ( Cfg :: from_str ( line) ?) )
260
- . filter ( TargetInfo :: not_user_specific_cfg)
261
- . collect :: < CargoResult < Vec < _ > > > ( )
262
- . with_context ( || {
263
- format ! (
264
- "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
265
- output
266
- )
267
- } ) ?;
258
+ let cfg = {
259
+ let mut res = Vec :: new ( ) ;
260
+ for line in & mut lines {
261
+ let cfg = Cfg :: from_str ( line) . with_context ( || {
262
+ format ! (
263
+ "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
264
+ output
265
+ )
266
+ } ) ?;
267
+ if TargetInfo :: not_user_specific_cfg ( & cfg) {
268
+ res. push ( cfg) ;
269
+ }
270
+ }
271
+ res
272
+ } ;
268
273
269
274
// recalculate `rustflags` from above now that we have `cfg`
270
275
// information
@@ -356,8 +361,8 @@ impl TargetInfo {
356
361
}
357
362
}
358
363
359
- fn not_user_specific_cfg ( cfg : & CargoResult < Cfg > ) -> bool {
360
- if let Ok ( Cfg :: Name ( cfg_name) ) = cfg {
364
+ fn not_user_specific_cfg ( cfg : & Cfg ) -> bool {
365
+ if let Cfg :: Name ( cfg_name) = cfg {
361
366
// This should also include "debug_assertions", but it causes
362
367
// regressions. Maybe some day in the distant future it can be
363
368
// added (and possibly change the warning to an error).
You can’t perform that action at this time.
0 commit comments