@@ -605,9 +605,7 @@ fn rustdoc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult
605
605
rustdoc. arg ( "--cfg" ) . arg ( & format ! ( "feature=\" {}\" " , feat) ) ;
606
606
}
607
607
608
- if bcx. build_config . json_messages ( ) {
609
- rustdoc. arg ( "--error-format" ) . arg ( "json" ) ;
610
- }
608
+ add_error_format ( bcx, & mut rustdoc) ;
611
609
612
610
if let Some ( ref args) = bcx. extra_args_for ( unit) {
613
611
rustdoc. args ( args) ;
@@ -706,6 +704,14 @@ fn add_color(bcx: &BuildContext, cmd: &mut ProcessBuilder) {
706
704
}
707
705
}
708
706
707
+ fn add_error_format ( bcx : & BuildContext , cmd : & mut ProcessBuilder ) {
708
+ match bcx. build_config . message_format {
709
+ MessageFormat :: Human => ( ) ,
710
+ MessageFormat :: Json => { cmd. arg ( "--error-format" ) . arg ( "json" ) ; } ,
711
+ MessageFormat :: Short => { cmd. arg ( "--error-format" ) . arg ( "short" ) ; } ,
712
+ }
713
+ }
714
+
709
715
fn build_base_args < ' a , ' cfg > (
710
716
cx : & mut Context < ' a , ' cfg > ,
711
717
cmd : & mut ProcessBuilder ,
@@ -732,12 +738,7 @@ fn build_base_args<'a, 'cfg>(
732
738
733
739
add_path_args ( bcx, unit, cmd) ;
734
740
add_color ( bcx, cmd) ;
735
-
736
- match bcx. build_config . message_format {
737
- MessageFormat :: Human => ( ) ,
738
- MessageFormat :: Json => { cmd. arg ( "--error-format" ) . arg ( "json" ) ; } ,
739
- MessageFormat :: Short => { cmd. arg ( "--error-format" ) . arg ( "short" ) ; } ,
740
- }
741
+ add_error_format ( bcx, cmd) ;
741
742
742
743
if !test {
743
744
for crate_type in crate_types. iter ( ) {
0 commit comments