File tree Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ pub enum HumanReadableErrorType {
4848 Short ,
4949}
5050
51+ impl HumanReadableErrorType {
52+ pub fn short ( & self ) -> bool {
53+ * self == HumanReadableErrorType :: Short
54+ }
55+ }
56+
5157#[ derive( Clone , Copy , Debug ) ]
5258struct Margin {
5359 /// 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 {
176176 }
177177
178178 fn should_show_explain ( & self ) -> bool {
179- !matches ! ( self . json_rendered, HumanReadableErrorType :: Short )
179+ !self . json_rendered . short ( )
180180 }
181181}
182182
@@ -356,7 +356,7 @@ impl Diagnostic {
356356
357357 let buf = BufWriter :: default ( ) ;
358358 let mut dst: Destination = Box :: new ( buf. clone ( ) ) ;
359- let short = matches ! ( je. json_rendered, HumanReadableErrorType :: Short ) ;
359+ let short = je. json_rendered . short ( ) ;
360360 match je. color_config {
361361 ColorConfig :: Always | ColorConfig :: Auto => dst = Box :: new ( termcolor:: Ansi :: new ( dst) ) ,
362362 ColorConfig :: Never => { }
Original file line number Diff line number Diff line change @@ -951,7 +951,7 @@ fn default_emitter(
951951 } ;
952952 match sopts. error_format {
953953 config:: ErrorOutputType :: HumanReadable ( kind, color_config) => {
954- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
954+ let short = kind. short ( ) ;
955955
956956 if let HumanReadableErrorType :: AnnotateSnippet = kind {
957957 let emitter = AnnotateSnippetEmitter :: new (
@@ -1427,7 +1427,7 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> {
14271427 fallback_fluent_bundle ( vec ! [ rustc_errors:: DEFAULT_LOCALE_RESOURCE ] , false ) ;
14281428 let emitter: Box < DynEmitter > = match output {
14291429 config:: ErrorOutputType :: HumanReadable ( kind, color_config) => {
1430- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
1430+ let short = kind. short ( ) ;
14311431 Box :: new (
14321432 HumanEmitter :: new ( stderr_destination ( color_config) , fallback_bundle)
14331433 . short_message ( short) ,
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ pub(crate) fn new_dcx(
139139 ) ;
140140 let emitter: Box < DynEmitter > = match error_format {
141141 ErrorOutputType :: HumanReadable ( kind, color_config) => {
142- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
142+ let short = kind. short ( ) ;
143143 Box :: new (
144144 HumanEmitter :: new ( stderr_destination ( color_config) , fallback_bundle)
145145 . sm ( source_map. map ( |sm| sm as _ ) )
Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ fn run_test(
423423 }
424424 } ) ;
425425 if let ErrorOutputType :: HumanReadable ( kind, color_config) = rustdoc_options. error_format {
426- let short = matches ! ( kind, HumanReadableErrorType :: Short ) ;
426+ let short = kind. short ( ) ;
427427
428428 if short {
429429 compiler. arg ( "--error-format" ) . arg ( "short" ) ;
You can’t perform that action at this time.
0 commit comments