Rename emit_struct->emit
This commit is contained in:
parent
55f06883b8
commit
a6e7239e7b
3 changed files with 6 additions and 6 deletions
|
@ -29,7 +29,7 @@ use term;
|
|||
/// implement `CoreEmitter` instead.
|
||||
pub trait Emitter {
|
||||
/// Emit a structured diagnostic.
|
||||
fn emit_struct(&mut self, db: &DiagnosticBuilder);
|
||||
fn emit(&mut self, db: &DiagnosticBuilder);
|
||||
}
|
||||
|
||||
pub trait CoreEmitter {
|
||||
|
@ -43,7 +43,7 @@ pub trait CoreEmitter {
|
|||
}
|
||||
|
||||
impl<T: CoreEmitter> Emitter for T {
|
||||
fn emit_struct(&mut self, db: &DiagnosticBuilder) {
|
||||
fn emit(&mut self, db: &DiagnosticBuilder) {
|
||||
let old_school = check_old_skool();
|
||||
let db_span = FullSpan(db.span.clone());
|
||||
self.emit_message(&FullSpan(db.span.clone()),
|
||||
|
|
|
@ -238,7 +238,7 @@ impl<'a> DiagnosticBuilder<'a> {
|
|||
return;
|
||||
}
|
||||
|
||||
self.handler.emit.borrow_mut().emit_struct(&self);
|
||||
self.handler.emitter.borrow_mut().emit(&self);
|
||||
self.cancel();
|
||||
self.handler.panic_if_treat_err_as_bug();
|
||||
|
||||
|
@ -420,7 +420,7 @@ impl<'a> Drop for DiagnosticBuilder<'a> {
|
|||
/// others log errors for later reporting.
|
||||
pub struct Handler {
|
||||
err_count: Cell<usize>,
|
||||
emit: RefCell<Box<Emitter>>,
|
||||
emitter: RefCell<Box<Emitter>>,
|
||||
pub can_emit_warnings: bool,
|
||||
treat_err_as_bug: bool,
|
||||
continue_after_error: Cell<bool>,
|
||||
|
@ -444,7 +444,7 @@ impl Handler {
|
|||
e: Box<Emitter>) -> Handler {
|
||||
Handler {
|
||||
err_count: Cell::new(0),
|
||||
emit: RefCell::new(e),
|
||||
emitter: RefCell::new(e),
|
||||
can_emit_warnings: can_emit_warnings,
|
||||
treat_err_as_bug: treat_err_as_bug,
|
||||
continue_after_error: Cell::new(true),
|
||||
|
|
|
@ -53,7 +53,7 @@ impl JsonEmitter {
|
|||
}
|
||||
|
||||
impl Emitter for JsonEmitter {
|
||||
fn emit_struct(&mut self, db: &DiagnosticBuilder) {
|
||||
fn emit(&mut self, db: &DiagnosticBuilder) {
|
||||
let data = Diagnostic::from_diagnostic_builder(db, self);
|
||||
if let Err(e) = writeln!(&mut self.dst, "{}", as_json(&data)) {
|
||||
panic!("failed to print diagnostics: {:?}", e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue