Remove a now-redundant single-variant enum
This commit is contained in:
parent
1e2167f5b5
commit
826a8ef52e
1 changed files with 5 additions and 43 deletions
|
@ -2158,7 +2158,7 @@ impl EmitterWriter {
|
||||||
Err(e) => panic!("failed to emit error: {e}"),
|
Err(e) => panic!("failed to emit error: {e}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dst = self.dst.writable();
|
let dst = self.dst.writable();
|
||||||
match writeln!(dst) {
|
match writeln!(dst) {
|
||||||
Err(e) => panic!("failed to emit error: {e}"),
|
Err(e) => panic!("failed to emit error: {e}"),
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -2573,7 +2573,7 @@ fn emit_to_destination(
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
use crate::lock;
|
use crate::lock;
|
||||||
|
|
||||||
let mut dst = dst.writable();
|
let dst = dst.writable();
|
||||||
|
|
||||||
// In order to prevent error message interleaving, where multiple error lines get intermixed
|
// In order to prevent error message interleaving, where multiple error lines get intermixed
|
||||||
// when multiple compiler processes error simultaneously, we emit errors with additional
|
// when multiple compiler processes error simultaneously, we emit errors with additional
|
||||||
|
@ -2608,10 +2608,6 @@ pub enum Destination {
|
||||||
Raw(Box<(dyn WriteColor + Send)>),
|
Raw(Box<(dyn WriteColor + Send)>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum WritableDst<'a> {
|
|
||||||
Raw(&'a mut (dyn WriteColor + Send)),
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Buffy {
|
struct Buffy {
|
||||||
buffer_writer: BufferWriter,
|
buffer_writer: BufferWriter,
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
|
@ -2661,10 +2657,10 @@ impl Destination {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn writable(&mut self) -> WritableDst<'_> {
|
fn writable(&mut self) -> &mut dyn WriteColor {
|
||||||
match *self {
|
match *self {
|
||||||
Destination::Terminal(ref mut t) => WritableDst::Raw(t),
|
Destination::Terminal(ref mut t) => t,
|
||||||
Destination::Raw(ref mut t) => WritableDst::Raw(t),
|
Destination::Raw(ref mut t) => t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2728,40 +2724,6 @@ impl Style {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WritableDst<'a> {
|
|
||||||
fn set_color(&mut self, color: &ColorSpec) -> io::Result<()> {
|
|
||||||
match *self {
|
|
||||||
WritableDst::Raw(ref mut t) => t.set_color(color),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reset(&mut self) -> io::Result<()> {
|
|
||||||
match *self {
|
|
||||||
WritableDst::Raw(ref mut t) => t.reset(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Write for WritableDst<'a> {
|
|
||||||
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
|
|
||||||
match *self {
|
|
||||||
WritableDst::Raw(ref mut w) => w.write(bytes),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flush(&mut self) -> io::Result<()> {
|
|
||||||
match *self {
|
|
||||||
WritableDst::Raw(ref mut w) => w.flush(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Drop for WritableDst<'a> {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
self.flush().unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether the original and suggested code are visually similar enough to warrant extra wording.
|
/// Whether the original and suggested code are visually similar enough to warrant extra wording.
|
||||||
pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
|
pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
|
||||||
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
|
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue