|
7 | 7 | //!
|
8 | 8 | //! The output types are defined in `rustc_session::config::ErrorOutputType`.
|
9 | 9 |
|
10 |
| -use Destination::*; |
11 |
| - |
12 | 10 | use rustc_span::source_map::SourceMap;
|
13 | 11 | use rustc_span::{FileLines, SourceFile, Span};
|
14 | 12 |
|
@@ -675,7 +673,7 @@ impl EmitterWriter {
|
675 | 673 | dst: Box<dyn WriteColor + Send>,
|
676 | 674 | fallback_bundle: LazyFallbackBundle,
|
677 | 675 | ) -> EmitterWriter {
|
678 |
| - Self::create(Raw(dst), fallback_bundle) |
| 676 | + Self::create(Destination(dst), fallback_bundle) |
679 | 677 | }
|
680 | 678 |
|
681 | 679 | fn maybe_anonymized(&self, line_num: usize) -> Cow<'static, str> {
|
@@ -2603,9 +2601,7 @@ fn emit_to_destination(
|
2603 | 2601 | Ok(())
|
2604 | 2602 | }
|
2605 | 2603 |
|
2606 |
| -pub enum Destination { |
2607 |
| - Raw(Box<(dyn WriteColor + Send)>), |
2608 |
| -} |
| 2604 | +pub struct Destination(pub(crate) Box<(dyn WriteColor + Send)>); |
2609 | 2605 |
|
2610 | 2606 | struct Buffy {
|
2611 | 2607 | buffer_writer: BufferWriter,
|
@@ -2648,24 +2644,20 @@ impl Destination {
|
2648 | 2644 | // On non-Windows we rely on the atomicity of `write` to ensure errors
|
2649 | 2645 | // don't get all jumbled up.
|
2650 | 2646 | if cfg!(windows) {
|
2651 |
| - Raw(Box::new(StandardStream::stderr(choice))) |
| 2647 | + Destination(Box::new(StandardStream::stderr(choice))) |
2652 | 2648 | } else {
|
2653 | 2649 | let buffer_writer = BufferWriter::stderr(choice);
|
2654 | 2650 | let buffer = buffer_writer.buffer();
|
2655 |
| - Raw(Box::new(Buffy { buffer_writer, buffer })) |
| 2651 | + Destination(Box::new(Buffy { buffer_writer, buffer })) |
2656 | 2652 | }
|
2657 | 2653 | }
|
2658 | 2654 |
|
2659 | 2655 | fn writable(&mut self) -> &mut dyn WriteColor {
|
2660 |
| - match *self { |
2661 |
| - Destination::Raw(ref mut t) => t, |
2662 |
| - } |
| 2656 | + &mut self.0 |
2663 | 2657 | }
|
2664 | 2658 |
|
2665 | 2659 | fn supports_color(&self) -> bool {
|
2666 |
| - match *self { |
2667 |
| - Self::Raw(ref writer) => writer.supports_color(), |
2668 |
| - } |
| 2660 | + self.0.supports_color() |
2669 | 2661 | }
|
2670 | 2662 | }
|
2671 | 2663 |
|
|
0 commit comments