Skip to content

Commit 826a8ef

Browse files
committed
Remove a now-redundant single-variant enum
1 parent 1e2167f commit 826a8ef

File tree

1 file changed

+5
-43
lines changed

1 file changed

+5
-43
lines changed

Diff for: compiler/rustc_errors/src/emitter.rs

+5-43
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,7 @@ impl EmitterWriter {
21582158
Err(e) => panic!("failed to emit error: {e}"),
21592159
}
21602160

2161-
let mut dst = self.dst.writable();
2161+
let dst = self.dst.writable();
21622162
match writeln!(dst) {
21632163
Err(e) => panic!("failed to emit error: {e}"),
21642164
_ => {
@@ -2573,7 +2573,7 @@ fn emit_to_destination(
25732573
) -> io::Result<()> {
25742574
use crate::lock;
25752575

2576-
let mut dst = dst.writable();
2576+
let dst = dst.writable();
25772577

25782578
// In order to prevent error message interleaving, where multiple error lines get intermixed
25792579
// when multiple compiler processes error simultaneously, we emit errors with additional
@@ -2608,10 +2608,6 @@ pub enum Destination {
26082608
Raw(Box<(dyn WriteColor + Send)>),
26092609
}
26102610

2611-
pub enum WritableDst<'a> {
2612-
Raw(&'a mut (dyn WriteColor + Send)),
2613-
}
2614-
26152611
struct Buffy {
26162612
buffer_writer: BufferWriter,
26172613
buffer: Buffer,
@@ -2661,10 +2657,10 @@ impl Destination {
26612657
}
26622658
}
26632659

2664-
fn writable(&mut self) -> WritableDst<'_> {
2660+
fn writable(&mut self) -> &mut dyn WriteColor {
26652661
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,
26682664
}
26692665
}
26702666

@@ -2728,40 +2724,6 @@ impl Style {
27282724
}
27292725
}
27302726

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-
27652727
/// Whether the original and suggested code are visually similar enough to warrant extra wording.
27662728
pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
27672729
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.

0 commit comments

Comments
 (0)