File tree 5 files changed +12
-6
lines changed
5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ pub enum HumanReadableErrorType {
48
48
Short ,
49
49
}
50
50
51
+ impl HumanReadableErrorType {
52
+ pub fn short ( & self ) -> bool {
53
+ * self == HumanReadableErrorType :: Short
54
+ }
55
+ }
56
+
51
57
#[ derive( Clone , Copy , Debug ) ]
52
58
struct Margin {
53
59
/// The available whitespace in the left that can be consumed when centering.
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ impl Emitter for JsonEmitter {
176
176
}
177
177
178
178
fn should_show_explain ( & self ) -> bool {
179
- !matches ! ( self . json_rendered, HumanReadableErrorType :: Short )
179
+ !self . json_rendered . short ( )
180
180
}
181
181
}
182
182
@@ -356,7 +356,7 @@ impl Diagnostic {
356
356
357
357
let buf = BufWriter :: default ( ) ;
358
358
let mut dst: Destination = Box :: new ( buf. clone ( ) ) ;
359
- let short = matches ! ( je. json_rendered, HumanReadableErrorType :: Short ) ;
359
+ let short = je. json_rendered . short ( ) ;
360
360
match je. color_config {
361
361
ColorConfig :: Always | ColorConfig :: Auto => dst = Box :: new ( termcolor:: Ansi :: new ( dst) ) ,
362
362
ColorConfig :: Never => { }
Original file line number Diff line number Diff line change @@ -951,7 +951,7 @@ fn default_emitter(
951
951
} ;
952
952
match sopts. error_format {
953
953
config:: ErrorOutputType :: HumanReadable ( kind, color_config) => {
954
- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
954
+ let short = kind. short ( ) ;
955
955
956
956
if let HumanReadableErrorType :: AnnotateSnippet = kind {
957
957
let emitter = AnnotateSnippetEmitter :: new (
@@ -1427,7 +1427,7 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> {
1427
1427
fallback_fluent_bundle ( vec ! [ rustc_errors:: DEFAULT_LOCALE_RESOURCE ] , false ) ;
1428
1428
let emitter: Box < DynEmitter > = match output {
1429
1429
config:: ErrorOutputType :: HumanReadable ( kind, color_config) => {
1430
- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
1430
+ let short = kind. short ( ) ;
1431
1431
Box :: new (
1432
1432
HumanEmitter :: new ( stderr_destination ( color_config) , fallback_bundle)
1433
1433
. short_message ( short) ,
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ pub(crate) fn new_dcx(
139
139
) ;
140
140
let emitter: Box < DynEmitter > = match error_format {
141
141
ErrorOutputType :: HumanReadable ( kind, color_config) => {
142
- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
142
+ let short = kind. short ( ) ;
143
143
Box :: new (
144
144
HumanEmitter :: new ( stderr_destination ( color_config) , fallback_bundle)
145
145
. sm ( source_map. map ( |sm| sm as _ ) )
Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ fn run_test(
423
423
}
424
424
} ) ;
425
425
if let ErrorOutputType :: HumanReadable ( kind, color_config) = rustdoc_options. error_format {
426
- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
426
+ let short = kind. short ( ) ;
427
427
428
428
if short {
429
429
compiler. arg ( "--error-format" ) . arg ( "short" ) ;
You can’t perform that action at this time.
0 commit comments