@@ -2158,7 +2158,7 @@ impl EmitterWriter {
2158
2158
Err ( e) => panic ! ( "failed to emit error: {e}" ) ,
2159
2159
}
2160
2160
2161
- let mut dst = self . dst . writable ( ) ;
2161
+ let dst = self . dst . writable ( ) ;
2162
2162
match writeln ! ( dst) {
2163
2163
Err ( e) => panic ! ( "failed to emit error: {e}" ) ,
2164
2164
_ => {
@@ -2573,7 +2573,7 @@ fn emit_to_destination(
2573
2573
) -> io:: Result < ( ) > {
2574
2574
use crate :: lock;
2575
2575
2576
- let mut dst = dst. writable ( ) ;
2576
+ let dst = dst. writable ( ) ;
2577
2577
2578
2578
// In order to prevent error message interleaving, where multiple error lines get intermixed
2579
2579
// when multiple compiler processes error simultaneously, we emit errors with additional
@@ -2608,10 +2608,6 @@ pub enum Destination {
2608
2608
Raw ( Box < ( dyn WriteColor + Send ) > ) ,
2609
2609
}
2610
2610
2611
- pub enum WritableDst < ' a > {
2612
- Raw ( & ' a mut ( dyn WriteColor + Send ) ) ,
2613
- }
2614
-
2615
2611
struct Buffy {
2616
2612
buffer_writer : BufferWriter ,
2617
2613
buffer : Buffer ,
@@ -2661,10 +2657,10 @@ impl Destination {
2661
2657
}
2662
2658
}
2663
2659
2664
- fn writable ( & mut self ) -> WritableDst < ' _ > {
2660
+ fn writable ( & mut self ) -> & mut dyn WriteColor {
2665
2661
match * self {
2666
- Destination :: Terminal ( ref mut t) => WritableDst :: Raw ( t ) ,
2667
- Destination :: Raw ( ref mut t) => WritableDst :: Raw ( t ) ,
2662
+ Destination :: Terminal ( ref mut t) => t ,
2663
+ Destination :: Raw ( ref mut t) => t ,
2668
2664
}
2669
2665
}
2670
2666
@@ -2728,40 +2724,6 @@ impl Style {
2728
2724
}
2729
2725
}
2730
2726
2731
- impl < ' a > WritableDst < ' a > {
2732
- fn set_color ( & mut self , color : & ColorSpec ) -> io:: Result < ( ) > {
2733
- match * self {
2734
- WritableDst :: Raw ( ref mut t) => t. set_color ( color) ,
2735
- }
2736
- }
2737
-
2738
- fn reset ( & mut self ) -> io:: Result < ( ) > {
2739
- match * self {
2740
- WritableDst :: Raw ( ref mut t) => t. reset ( ) ,
2741
- }
2742
- }
2743
- }
2744
-
2745
- impl < ' a > Write for WritableDst < ' a > {
2746
- fn write ( & mut self , bytes : & [ u8 ] ) -> io:: Result < usize > {
2747
- match * self {
2748
- WritableDst :: Raw ( ref mut w) => w. write ( bytes) ,
2749
- }
2750
- }
2751
-
2752
- fn flush ( & mut self ) -> io:: Result < ( ) > {
2753
- match * self {
2754
- WritableDst :: Raw ( ref mut w) => w. flush ( ) ,
2755
- }
2756
- }
2757
- }
2758
-
2759
- impl < ' a > Drop for WritableDst < ' a > {
2760
- fn drop ( & mut self ) {
2761
- self . flush ( ) . unwrap ( )
2762
- }
2763
- }
2764
-
2765
2727
/// Whether the original and suggested code are visually similar enough to warrant extra wording.
2766
2728
pub fn is_case_difference ( sm : & SourceMap , suggested : & str , sp : Span ) -> bool {
2767
2729
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
0 commit comments