@@ -164,7 +164,7 @@ pub fn test_command(mut config: Config, path: &Path) -> Result<Command> {
164
164
comments : & comments,
165
165
path,
166
166
} ;
167
- let mut result = build_command ( & config ) . unwrap ( ) ;
167
+ let mut result = config . build_command ( ) . unwrap ( ) ;
168
168
result. args ( extra_args) ;
169
169
170
170
Ok ( result)
@@ -431,52 +431,6 @@ fn parse_and_test_file(
431
431
. collect ( ) )
432
432
}
433
433
434
- fn build_command ( config : & TestConfig ) -> Result < Command , Errored > {
435
- let TestConfig {
436
- config,
437
- revision,
438
- comments,
439
- path,
440
- } = config;
441
- let mut cmd = config. program . build ( & config. out_dir ) ;
442
- cmd. arg ( path) ;
443
- if !revision. is_empty ( ) {
444
- cmd. arg ( format ! ( "--cfg={revision}" ) ) ;
445
- }
446
- for arg in comments
447
- . for_revision ( revision)
448
- . flat_map ( |r| r. compile_flags . iter ( ) )
449
- {
450
- cmd. arg ( arg) ;
451
- }
452
- let edition = comments. edition ( revision) ?;
453
-
454
- if let Some ( edition) = edition {
455
- cmd. arg ( "--edition" ) . arg ( & * edition) ;
456
- }
457
-
458
- if let Some ( target) = & config. target {
459
- // Adding a `--target` arg to calls to Cargo will cause target folders
460
- // to create a target-specific sub-folder. We can avoid that by just
461
- // not passing a `--target` arg if its the same as the host.
462
- if !config. host_matches ( target) {
463
- cmd. arg ( "--target" ) . arg ( target) ;
464
- }
465
- }
466
-
467
- // False positive in miri, our `map` uses a ref pattern to get the references to the tuple fields instead
468
- // of a reference to a tuple
469
- #[ allow( clippy:: map_identity) ]
470
- cmd. envs (
471
- comments
472
- . for_revision ( revision)
473
- . flat_map ( |r| r. env_vars . iter ( ) )
474
- . map ( |( k, v) | ( k, v) ) ,
475
- ) ;
476
-
477
- Ok ( cmd)
478
- }
479
-
480
434
fn build_aux (
481
435
aux_file : & Path ,
482
436
config : & Config ,
@@ -534,7 +488,7 @@ fn build_aux(
534
488
535
489
config. patch_out_dir ( ) ;
536
490
537
- let mut aux_cmd = build_command ( & config ) ?;
491
+ let mut aux_cmd = config . build_command ( ) ?;
538
492
539
493
let mut extra_args = build_aux_files (
540
494
aux_file. parent ( ) . unwrap ( ) ,
@@ -594,7 +548,7 @@ fn run_test(build_manager: &BuildManager<'_>, mut config: TestConfig<'_>) -> Tes
594
548
595
549
config. patch_out_dir ( ) ;
596
550
597
- let mut cmd = build_command ( & config ) ?;
551
+ let mut cmd = config . build_command ( ) ?;
598
552
cmd. args ( & extra_args) ;
599
553
let stdin = config. path . with_extension ( config. extension ( "stdin" ) ) ;
600
554
if stdin. exists ( ) {
@@ -871,7 +825,7 @@ fn run_rustfix(
871
825
return Ok ( ( ) ) ;
872
826
}
873
827
874
- let mut cmd = build_command ( & config ) ?;
828
+ let mut cmd = config . build_command ( ) ?;
875
829
cmd. args ( extra_args) ;
876
830
cmd. arg ( "--crate-name" ) . arg ( crate_name) ;
877
831
let output = cmd. output ( ) . unwrap ( ) ;
0 commit comments