@@ -381,12 +381,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
381
381
args. apply ( & mut rustc) ;
382
382
383
383
trace ! ( "start rustfixing {:?}" , args. file) ;
384
- let json_error_rustc = {
385
- let mut cmd = rustc. clone ( ) ;
386
- cmd. arg ( "--error-format=json" ) ;
387
- cmd
388
- } ;
389
- let fixes = rustfix_crate ( & lock_addr, & json_error_rustc, & args. file , & args, config) ?;
384
+ let fixes = rustfix_crate ( & lock_addr, & rustc, & args. file , & args, config) ?;
390
385
391
386
// Ok now we have our final goal of testing out the changes that we applied.
392
387
// If these changes went awry and actually started to cause the crate to
@@ -397,8 +392,8 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
397
392
// new rustc, and otherwise we capture the output to hide it in the scenario
398
393
// that we have to back it all out.
399
394
if !fixes. files . is_empty ( ) {
400
- debug ! ( "calling rustc for final verification: {json_error_rustc }" ) ;
401
- let output = json_error_rustc . output ( ) ?;
395
+ debug ! ( "calling rustc for final verification: {rustc }" ) ;
396
+ let output = rustc . output ( ) ?;
402
397
403
398
if output. status . success ( ) {
404
399
for ( path, file) in fixes. files . iter ( ) {
@@ -429,7 +424,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
429
424
}
430
425
431
426
let krate = {
432
- let mut iter = json_error_rustc . get_args ( ) ;
427
+ let mut iter = rustc . get_args ( ) ;
433
428
let mut krate = None ;
434
429
while let Some ( arg) = iter. next ( ) {
435
430
if arg == "--crate-name" {
@@ -446,11 +441,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
446
441
// - If the fix failed, show the original warnings and suggestions.
447
442
// - If `--broken-code`, show the error messages.
448
443
// - If the fix succeeded, show any remaining warnings.
449
- for arg in args. format_args {
450
- // Add any json/error format arguments that Cargo wants. This allows
451
- // things like colored output to work correctly.
452
- rustc. arg ( arg) ;
453
- }
444
+ //
454
445
// Removes `FD_CLOEXEC` set by `jobserver::Client` to pass jobserver
455
446
// as environment variables specify.
456
447
if let Some ( client) = config. jobserver_from_env ( ) {
@@ -799,12 +790,6 @@ struct FixArgs {
799
790
other : Vec < OsString > ,
800
791
/// Path to the `rustc` executable.
801
792
rustc : PathBuf ,
802
- /// Console output flags (`--error-format`, `--json`, etc.).
803
- ///
804
- /// The normal fix procedure always uses `--json`, so it overrides what
805
- /// Cargo normally passes when applying fixes. When displaying warnings or
806
- /// errors, it will use these flags.
807
- format_args : Vec < String > ,
808
793
}
809
794
810
795
impl FixArgs {
@@ -822,7 +807,6 @@ impl FixArgs {
822
807
let mut file = None ;
823
808
let mut enabled_edition = None ;
824
809
let mut other = Vec :: new ( ) ;
825
- let mut format_args = Vec :: new ( ) ;
826
810
827
811
let mut handle_arg = |arg : OsString | -> CargoResult < ( ) > {
828
812
let path = PathBuf :: from ( arg) ;
@@ -835,12 +819,6 @@ impl FixArgs {
835
819
enabled_edition = Some ( edition. parse ( ) ?) ;
836
820
return Ok ( ( ) ) ;
837
821
}
838
- if s. starts_with ( "--error-format=" ) || s. starts_with ( "--json=" ) {
839
- // Cargo may add error-format in some cases, but `cargo
840
- // fix` wants to add its own.
841
- format_args. push ( s. to_string ( ) ) ;
842
- return Ok ( ( ) ) ;
843
- }
844
822
}
845
823
other. push ( path. into ( ) ) ;
846
824
Ok ( ( ) )
@@ -890,7 +868,6 @@ impl FixArgs {
890
868
enabled_edition,
891
869
other,
892
870
rustc,
893
- format_args,
894
871
} )
895
872
}
896
873
0 commit comments