@@ -386,12 +386,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
386386 }
387387
388388 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) ?;
395390
396391 // Ok now we have our final goal of testing out the changes that we applied.
397392 // 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<()> {
402397 // new rustc, and otherwise we capture the output to hide it in the scenario
403398 // that we have to back it all out.
404399 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 ( ) ?;
407402
408403 if output. status . success ( ) {
409404 for ( path, file) in fixes. files . iter ( ) {
@@ -434,7 +429,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
434429 }
435430
436431 let krate = {
437- let mut iter = json_error_rustc . get_args ( ) ;
432+ let mut iter = rustc . get_args ( ) ;
438433 let mut krate = None ;
439434 while let Some ( arg) = iter. next ( ) {
440435 if arg == "--crate-name" {
@@ -451,11 +446,6 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
451446 // - If the fix failed, show the original warnings and suggestions.
452447 // - If `--broken-code`, show the error messages.
453448 // - 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- }
459449 debug ! ( "calling rustc to display remaining diagnostics: {rustc}" ) ;
460450 exit_with ( rustc. status ( ) ?) ;
461451}
@@ -799,12 +789,6 @@ struct FixArgs {
799789 other : Vec < OsString > ,
800790 /// Path to the `rustc` executable.
801791 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 > ,
808792}
809793
810794impl FixArgs {
@@ -822,7 +806,6 @@ impl FixArgs {
822806 let mut file = None ;
823807 let mut enabled_edition = None ;
824808 let mut other = Vec :: new ( ) ;
825- let mut format_args = Vec :: new ( ) ;
826809
827810 let mut handle_arg = |arg : OsString | -> CargoResult < ( ) > {
828811 let path = PathBuf :: from ( arg) ;
@@ -835,12 +818,6 @@ impl FixArgs {
835818 enabled_edition = Some ( edition. parse ( ) ?) ;
836819 return Ok ( ( ) ) ;
837820 }
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- }
844821 }
845822 other. push ( path. into ( ) ) ;
846823 Ok ( ( ) )
@@ -890,7 +867,6 @@ impl FixArgs {
890867 enabled_edition,
891868 other,
892869 rustc,
893- format_args,
894870 } )
895871 }
896872
0 commit comments