@@ -386,12 +386,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
386
386
}
387
387
388
388
trace ! ( "start rustfixing {:?}" , args. file) ;
389
- let json_error_rustc = {
390
- let mut cmd = rustc. clone ( ) ;
391
- cmd. arg ( "--error-format=json" ) ;
392
- cmd
393
- } ;
394
- let fixes = rustfix_crate ( & lock_addr, & json_error_rustc, & args. file , & args, config) ?;
389
+ let fixes = rustfix_crate ( & lock_addr, & rustc, & args. file , & args, config) ?;
395
390
396
391
// Ok now we have our final goal of testing out the changes that we applied.
397
392
// If these changes went awry and actually started to cause the crate to
@@ -402,8 +397,8 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
402
397
// new rustc, and otherwise we capture the output to hide it in the scenario
403
398
// that we have to back it all out.
404
399
if !fixes. files . is_empty ( ) {
405
- debug ! ( "calling rustc for final verification: {json_error_rustc }" ) ;
406
- let output = json_error_rustc . output ( ) ?;
400
+ debug ! ( "calling rustc for final verification: {rustc }" ) ;
401
+ let output = rustc . output ( ) ?;
407
402
408
403
if output. status . success ( ) {
409
404
for ( path, file) in fixes. files . iter ( ) {
@@ -434,7 +429,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
434
429
}
435
430
436
431
let krate = {
437
- let mut iter = json_error_rustc . get_args ( ) ;
432
+ let mut iter = rustc . get_args ( ) ;
438
433
let mut krate = None ;
439
434
while let Some ( arg) = iter. next ( ) {
440
435
if arg == "--crate-name" {
@@ -451,11 +446,6 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
451
446
// - If the fix failed, show the original warnings and suggestions.
452
447
// - If `--broken-code`, show the error messages.
453
448
// - If the fix succeeded, show any remaining warnings.
454
- for arg in args. format_args {
455
- // Add any json/error format arguments that Cargo wants. This allows
456
- // things like colored output to work correctly.
457
- rustc. arg ( arg) ;
458
- }
459
449
debug ! ( "calling rustc to display remaining diagnostics: {rustc}" ) ;
460
450
exit_with ( rustc. status ( ) ?) ;
461
451
}
@@ -799,12 +789,6 @@ struct FixArgs {
799
789
other : Vec < OsString > ,
800
790
/// Path to the `rustc` executable.
801
791
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
792
}
809
793
810
794
impl FixArgs {
@@ -822,7 +806,6 @@ impl FixArgs {
822
806
let mut file = None ;
823
807
let mut enabled_edition = None ;
824
808
let mut other = Vec :: new ( ) ;
825
- let mut format_args = Vec :: new ( ) ;
826
809
827
810
let mut handle_arg = |arg : OsString | -> CargoResult < ( ) > {
828
811
let path = PathBuf :: from ( arg) ;
@@ -835,12 +818,6 @@ impl FixArgs {
835
818
enabled_edition = Some ( edition. parse ( ) ?) ;
836
819
return Ok ( ( ) ) ;
837
820
}
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
821
}
845
822
other. push ( path. into ( ) ) ;
846
823
Ok ( ( ) )
@@ -890,7 +867,6 @@ impl FixArgs {
890
867
enabled_edition,
891
868
other,
892
869
rustc,
893
- format_args,
894
870
} )
895
871
}
896
872
0 commit comments