File tree 1 file changed +8
-5
lines changed
compiler/rustc_errors/src
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2590,7 +2590,8 @@ fn emit_to_destination(
2590
2590
let _buffer_lock = lock:: acquire_global_lock ( "rustc_errors" ) ;
2591
2591
for ( pos, line) in rendered_buffer. iter ( ) . enumerate ( ) {
2592
2592
for part in line {
2593
- dst. apply_style ( * lvl, part. style ) ?;
2593
+ let style = part. style . color_spec ( * lvl) ;
2594
+ dst. set_color ( & style) ?;
2594
2595
write ! ( dst, "{}" , part. text) ?;
2595
2596
dst. reset ( ) ?;
2596
2597
}
@@ -2675,10 +2676,10 @@ impl Destination {
2675
2676
}
2676
2677
}
2677
2678
2678
- impl < ' a > WritableDst < ' a > {
2679
- fn apply_style ( & mut self , lvl : Level , style : Style ) -> io :: Result < ( ) > {
2679
+ impl Style {
2680
+ fn color_spec ( & self , lvl : Level ) -> ColorSpec {
2680
2681
let mut spec = ColorSpec :: new ( ) ;
2681
- match style {
2682
+ match self {
2682
2683
Style :: Addition => {
2683
2684
spec. set_fg ( Some ( Color :: Green ) ) . set_intense ( true ) ;
2684
2685
}
@@ -2723,9 +2724,11 @@ impl<'a> WritableDst<'a> {
2723
2724
spec. set_bold ( true ) ;
2724
2725
}
2725
2726
}
2726
- self . set_color ( & spec)
2727
+ spec
2727
2728
}
2729
+ }
2728
2730
2731
+ impl < ' a > WritableDst < ' a > {
2729
2732
fn set_color ( & mut self , color : & ColorSpec ) -> io:: Result < ( ) > {
2730
2733
match * self {
2731
2734
WritableDst :: Raw ( ref mut t) => t. set_color ( color) ,
You can’t perform that action at this time.
0 commit comments