1
Fork 0

Rename EmitterWriter as HumanEmitter.

For consistency with other `Emitter` impls, such as `JsonEmitter`,
`SilentEmitter`, `SharedEmitter`, etc.
This commit is contained in:
Nicholas Nethercote 2024-01-05 10:02:40 +11:00
parent e51e98dde6
commit cb9abcae79
9 changed files with 29 additions and 29 deletions

View file

@ -61,13 +61,13 @@ impl HumanReadableErrorType {
self,
mut dst: Box<dyn WriteColor + Send>,
fallback_bundle: LazyFallbackBundle,
) -> EmitterWriter {
) -> HumanEmitter {
let (short, color_config) = self.unzip();
let color = color_config.suggests_using_colors();
if !dst.supports_color() && color {
dst = Box::new(Ansi::new(dst));
}
EmitterWriter::new(dst, fallback_bundle).short_message(short)
HumanEmitter::new(dst, fallback_bundle).short_message(short)
}
}
@ -501,7 +501,7 @@ pub trait Emitter: Translate {
}
}
impl Translate for EmitterWriter {
impl Translate for HumanEmitter {
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
self.fluent_bundle.as_ref()
}
@ -511,7 +511,7 @@ impl Translate for EmitterWriter {
}
}
impl Emitter for EmitterWriter {
impl Emitter for HumanEmitter {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
self.sm.as_ref()
}
@ -622,7 +622,7 @@ impl ColorConfig {
/// Handles the writing of `HumanReadableErrorType::Default` and `HumanReadableErrorType::Short`
#[derive(Setters)]
pub struct EmitterWriter {
pub struct HumanEmitter {
#[setters(skip)]
dst: IntoDynSyncSend<Destination>,
sm: Option<Lrc<SourceMap>>,
@ -647,14 +647,14 @@ pub struct FileWithAnnotatedLines {
multiline_depth: usize,
}
impl EmitterWriter {
pub fn stderr(color_config: ColorConfig, fallback_bundle: LazyFallbackBundle) -> EmitterWriter {
impl HumanEmitter {
pub fn stderr(color_config: ColorConfig, fallback_bundle: LazyFallbackBundle) -> HumanEmitter {
let dst = from_stderr(color_config);
Self::create(dst, fallback_bundle)
}
fn create(dst: Destination, fallback_bundle: LazyFallbackBundle) -> EmitterWriter {
EmitterWriter {
fn create(dst: Destination, fallback_bundle: LazyFallbackBundle) -> HumanEmitter {
HumanEmitter {
dst: IntoDynSyncSend(dst),
sm: None,
fluent_bundle: None,
@ -673,7 +673,7 @@ impl EmitterWriter {
pub fn new(
dst: Box<dyn WriteColor + Send>,
fallback_bundle: LazyFallbackBundle,
) -> EmitterWriter {
) -> HumanEmitter {
Self::create(dst, fallback_bundle)
}

View file

@ -53,7 +53,7 @@ pub use snippet::Style;
pub use termcolor::{Color, ColorSpec, WriteColor};
use crate::diagnostic_impls::{DelayedAtWithNewline, DelayedAtWithoutNewline};
use emitter::{is_case_difference, DynEmitter, Emitter, EmitterWriter};
use emitter::{is_case_difference, DynEmitter, Emitter, HumanEmitter};
use registry::Registry;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
@ -574,7 +574,7 @@ impl DiagCtxt {
sm: Option<Lrc<SourceMap>>,
fallback_bundle: LazyFallbackBundle,
) -> Self {
let emitter = Box::new(EmitterWriter::stderr(ColorConfig::Auto, fallback_bundle).sm(sm));
let emitter = Box::new(HumanEmitter::stderr(ColorConfig::Auto, fallback_bundle).sm(sm));
Self::with_emitter(emitter)
}
pub fn disable_warnings(mut self) -> Self {