@@ -1719,40 +1719,36 @@ impl EmitterWriter {
1719
1719
if !self . short_message {
1720
1720
for child in children {
1721
1721
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 (
1723
1723
& span,
1724
1724
& child. styled_message ( ) ,
1725
1725
& None ,
1726
1726
& child. level ,
1727
1727
max_line_num_len,
1728
1728
true ,
1729
1729
) {
1730
- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1731
- _ => ( ) ,
1730
+ panic ! ( "failed to emit error: {}" , err) ;
1732
1731
}
1733
1732
}
1734
1733
for sugg in suggestions {
1735
1734
if sugg. style == SuggestionStyle :: CompletelyHidden {
1736
1735
// do not display this suggestion, it is meant only for tools
1737
1736
} else if sugg. style == SuggestionStyle :: HideCodeAlways {
1738
- match self . emit_message_default (
1737
+ if let Err ( e ) = self . emit_message_default (
1739
1738
& MultiSpan :: new ( ) ,
1740
1739
& [ ( sugg. msg . to_owned ( ) , Style :: HeaderMsg ) ] ,
1741
1740
& None ,
1742
1741
& Level :: Help ,
1743
1742
max_line_num_len,
1744
1743
true ,
1745
1744
) {
1746
- Err ( e) => panic ! ( "failed to emit error: {}" , e) ,
1747
- _ => ( ) ,
1745
+ panic ! ( "failed to emit error: {}" , e) ;
1748
1746
}
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
+ } ;
1756
1752
}
1757
1753
}
1758
1754
}
@@ -1762,10 +1758,11 @@ impl EmitterWriter {
1762
1758
let mut dst = self . dst . writable ( ) ;
1763
1759
match writeln ! ( dst) {
1764
1760
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
+ }
1769
1766
}
1770
1767
}
1771
1768
}
@@ -2149,11 +2146,8 @@ impl<'a> Write for WritableDst<'a> {
2149
2146
2150
2147
impl < ' a > Drop for WritableDst < ' a > {
2151
2148
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) ) ;
2157
2151
}
2158
2152
}
2159
2153
}
0 commit comments