Rename AnnotateSnippetEmitterWriter as AnnotateSnippetEmitter.

For consistency with other `Emitter` impls.
This commit is contained in:
Nicholas Nethercote 2024-01-05 10:37:44 +11:00
parent cb9abcae79
commit c4d63c7f76
2 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ use rustc_span::source_map::SourceMap;
use rustc_span::SourceFile; use rustc_span::SourceFile;
/// Generates diagnostics using annotate-snippet /// Generates diagnostics using annotate-snippet
pub struct AnnotateSnippetEmitterWriter { pub struct AnnotateSnippetEmitter {
source_map: Option<Lrc<SourceMap>>, source_map: Option<Lrc<SourceMap>>,
fluent_bundle: Option<Lrc<FluentBundle>>, fluent_bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle, fallback_bundle: LazyFallbackBundle,
@ -33,7 +33,7 @@ pub struct AnnotateSnippetEmitterWriter {
macro_backtrace: bool, macro_backtrace: bool,
} }
impl Translate for AnnotateSnippetEmitterWriter { impl Translate for AnnotateSnippetEmitter {
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> { fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
self.fluent_bundle.as_ref() self.fluent_bundle.as_ref()
} }
@ -43,7 +43,7 @@ impl Translate for AnnotateSnippetEmitterWriter {
} }
} }
impl Emitter for AnnotateSnippetEmitterWriter { impl Emitter for AnnotateSnippetEmitter {
/// The entry point for the diagnostics generation /// The entry point for the diagnostics generation
fn emit_diagnostic(&mut self, diag: &Diagnostic) { fn emit_diagnostic(&mut self, diag: &Diagnostic) {
let fluent_args = to_fluent_args(diag.args()); let fluent_args = to_fluent_args(diag.args());
@ -99,7 +99,7 @@ fn annotation_type_for_level(level: Level) -> AnnotationType {
} }
} }
impl AnnotateSnippetEmitterWriter { impl AnnotateSnippetEmitter {
pub fn new( pub fn new(
source_map: Option<Lrc<SourceMap>>, source_map: Option<Lrc<SourceMap>>,
fluent_bundle: Option<Lrc<FluentBundle>>, fluent_bundle: Option<Lrc<FluentBundle>>,

View File

@ -17,7 +17,7 @@ use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
use rustc_data_structures::sync::{ use rustc_data_structures::sync::{
AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread, Ordering::SeqCst, AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread, Ordering::SeqCst,
}; };
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter; use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType}; use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType};
use rustc_errors::json::JsonEmitter; use rustc_errors::json::JsonEmitter;
use rustc_errors::registry::Registry; use rustc_errors::registry::Registry;
@ -1000,7 +1000,7 @@ fn default_emitter(
let (short, color_config) = kind.unzip(); let (short, color_config) = kind.unzip();
if let HumanReadableErrorType::AnnotateSnippet(_) = kind { if let HumanReadableErrorType::AnnotateSnippet(_) = kind {
let emitter = AnnotateSnippetEmitterWriter::new( let emitter = AnnotateSnippetEmitter::new(
Some(source_map), Some(source_map),
bundle, bundle,
fallback_bundle, fallback_bundle,