Remove a bool for color in favor of the WriteColor trait wrapping colored and uncolored printing
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
// FIXME: spec the JSON output properly.
|
||||
|
||||
use rustc_span::source_map::{FilePathMapping, SourceMap};
|
||||
use termcolor::{ColorSpec, WriteColor};
|
||||
|
||||
use crate::emitter::{Emitter, HumanReadableErrorType};
|
||||
use crate::registry::Registry;
|
||||
@@ -356,6 +357,19 @@ impl Diagnostic {
|
||||
self.0.lock().unwrap().flush()
|
||||
}
|
||||
}
|
||||
impl WriteColor for BufWriter {
|
||||
fn supports_color(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_color(&mut self, _spec: &ColorSpec) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
let buf = BufWriter::default();
|
||||
let output = buf.clone();
|
||||
je.json_rendered
|
||||
|
||||
Reference in New Issue
Block a user