@@ -469,25 +469,26 @@ pub trait ArgMatchesExt {
469
469
ansi : false ,
470
470
render_diagnostics : false ,
471
471
} ;
472
+ let two_kinds_of_msg_format_err = "cannot specify two kinds of `message-format` arguments" ;
472
473
for fmt in self . _values_of ( "message-format" ) {
473
474
for fmt in fmt. split ( ',' ) {
474
475
let fmt = fmt. to_ascii_lowercase ( ) ;
475
476
match fmt. as_str ( ) {
476
477
"json" => {
477
478
if message_format. is_some ( ) {
478
- bail ! ( "cannot specify two kinds of `message-format` arguments" ) ;
479
+ bail ! ( two_kinds_of_msg_format_err ) ;
479
480
}
480
481
message_format = Some ( default_json) ;
481
482
}
482
483
"human" => {
483
484
if message_format. is_some ( ) {
484
- bail ! ( "cannot specify two kinds of `message-format` arguments" ) ;
485
+ bail ! ( two_kinds_of_msg_format_err ) ;
485
486
}
486
487
message_format = Some ( MessageFormat :: Human ) ;
487
488
}
488
489
"short" => {
489
490
if message_format. is_some ( ) {
490
- bail ! ( "cannot specify two kinds of `message-format` arguments" ) ;
491
+ bail ! ( two_kinds_of_msg_format_err ) ;
491
492
}
492
493
message_format = Some ( MessageFormat :: Short ) ;
493
494
}
@@ -499,7 +500,7 @@ pub trait ArgMatchesExt {
499
500
Some ( MessageFormat :: Json {
500
501
render_diagnostics, ..
501
502
} ) => * render_diagnostics = true ,
502
- _ => bail ! ( "cannot specify two kinds of `message-format` arguments" ) ,
503
+ _ => bail ! ( two_kinds_of_msg_format_err ) ,
503
504
}
504
505
}
505
506
"json-diagnostic-short" => {
@@ -508,7 +509,7 @@ pub trait ArgMatchesExt {
508
509
}
509
510
match & mut message_format {
510
511
Some ( MessageFormat :: Json { short, .. } ) => * short = true ,
511
- _ => bail ! ( "cannot specify two kinds of `message-format` arguments" ) ,
512
+ _ => bail ! ( two_kinds_of_msg_format_err ) ,
512
513
}
513
514
}
514
515
"json-diagnostic-rendered-ansi" => {
@@ -517,7 +518,7 @@ pub trait ArgMatchesExt {
517
518
}
518
519
match & mut message_format {
519
520
Some ( MessageFormat :: Json { ansi, .. } ) => * ansi = true ,
520
- _ => bail ! ( "cannot specify two kinds of `message-format` arguments" ) ,
521
+ _ => bail ! ( two_kinds_of_msg_format_err ) ,
521
522
}
522
523
}
523
524
s => bail ! ( "invalid message format specifier: `{}`" , s) ,
0 commit comments