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)
}