@@ -1719,40 +1719,36 @@ impl EmitterWriter {
17191719 if !self . short_message {
17201720 for child in children {
17211721 let span = child. render_span . as_ref ( ) . unwrap_or ( & child. span ) ;
1722- match self . emit_message_default (
1722+ if let Err ( err ) = self . emit_message_default (
17231723 & span,
17241724 & child. styled_message ( ) ,
17251725 & None ,
17261726 & child. level ,
17271727 max_line_num_len,
17281728 true ,
17291729 ) {
1730- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1731- _ => ( ) ,
1730+ panic ! ( "failed to emit error: {}" , err) ;
17321731 }
17331732 }
17341733 for sugg in suggestions {
17351734 if sugg. style == SuggestionStyle :: CompletelyHidden {
17361735 // do not display this suggestion, it is meant only for tools
17371736 } else if sugg. style == SuggestionStyle :: HideCodeAlways {
1738- match self . emit_message_default (
1737+ if let Err ( e ) = self . emit_message_default (
17391738 & MultiSpan :: new ( ) ,
17401739 & [ ( sugg. msg . to_owned ( ) , Style :: HeaderMsg ) ] ,
17411740 & None ,
17421741 & Level :: Help ,
17431742 max_line_num_len,
17441743 true ,
17451744 ) {
1746- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1747- _ => ( ) ,
1745+ panic ! ( "failed to emit error: {}" , e) ;
17481746 }
1749- } else {
1750- match self . emit_suggestion_default ( sugg, & Level :: Help , max_line_num_len)
1751- {
1752- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1753- _ => ( ) ,
1754- }
1755- }
1747+ } else if let Err ( e) =
1748+ self . emit_suggestion_default ( sugg, & Level :: Help , max_line_num_len)
1749+ {
1750+ panic ! ( "failed to emit error: {}" , e) ;
1751+ } ;
17561752 }
17571753 }
17581754 }
@@ -1762,10 +1758,11 @@ impl EmitterWriter {
17621758 let mut dst = self . dst . writable ( ) ;
17631759 match writeln ! ( dst) {
17641760 Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1765- _ => match dst. flush ( ) {
1766- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1767- _ => ( ) ,
1768- } ,
1761+ _ => {
1762+ if let Err ( e) = dst. flush ( ) {
1763+ panic ! ( "failed to emit error: {}" , e)
1764+ }
1765+ }
17691766 }
17701767 }
17711768}
@@ -2149,11 +2146,8 @@ impl<'a> Write for WritableDst<'a> {
21492146
21502147impl < ' a > Drop for WritableDst < ' a > {
21512148 fn drop ( & mut self ) {
2152- match * self {
2153- WritableDst :: Buffered ( ref mut dst, ref mut buf) => {
2154- drop ( dst. print ( buf) ) ;
2155- }
2156- _ => { }
2149+ if let WritableDst :: Buffered ( ref mut dst, ref mut buf) = self {
2150+ drop ( dst. print ( buf) ) ;
21572151 }
21582152 }
21592153}
0 commit comments