1
Fork 0

Rename emit_struct->emit

This commit is contained in:
Jonathan Turner 2016-07-07 07:50:49 -04:00
parent 55f06883b8
commit a6e7239e7b
3 changed files with 6 additions and 6 deletions

View file

@ -29,7 +29,7 @@ use term;
/// implement `CoreEmitter` instead. /// implement `CoreEmitter` instead.
pub trait Emitter { pub trait Emitter {
/// Emit a structured diagnostic. /// Emit a structured diagnostic.
fn emit_struct(&mut self, db: &DiagnosticBuilder); fn emit(&mut self, db: &DiagnosticBuilder);
} }
pub trait CoreEmitter { pub trait CoreEmitter {
@ -43,7 +43,7 @@ pub trait CoreEmitter {
} }
impl<T: CoreEmitter> Emitter for T { 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 old_school = check_old_skool();
let db_span = FullSpan(db.span.clone()); let db_span = FullSpan(db.span.clone());
self.emit_message(&FullSpan(db.span.clone()), self.emit_message(&FullSpan(db.span.clone()),

View file

@ -238,7 +238,7 @@ impl<'a> DiagnosticBuilder<'a> {
return; return;
} }
self.handler.emit.borrow_mut().emit_struct(&self); self.handler.emitter.borrow_mut().emit(&self);
self.cancel(); self.cancel();
self.handler.panic_if_treat_err_as_bug(); self.handler.panic_if_treat_err_as_bug();
@ -420,7 +420,7 @@ impl<'a> Drop for DiagnosticBuilder<'a> {
/// others log errors for later reporting. /// others log errors for later reporting.
pub struct Handler { pub struct Handler {
err_count: Cell<usize>, err_count: Cell<usize>,
emit: RefCell<Box<Emitter>>, emitter: RefCell<Box<Emitter>>,
pub can_emit_warnings: bool, pub can_emit_warnings: bool,
treat_err_as_bug: bool, treat_err_as_bug: bool,
continue_after_error: Cell<bool>, continue_after_error: Cell<bool>,
@ -444,7 +444,7 @@ impl Handler {
e: Box<Emitter>) -> Handler { e: Box<Emitter>) -> Handler {
Handler { Handler {
err_count: Cell::new(0), err_count: Cell::new(0),
emit: RefCell::new(e), emitter: RefCell::new(e),
can_emit_warnings: can_emit_warnings, can_emit_warnings: can_emit_warnings,
treat_err_as_bug: treat_err_as_bug, treat_err_as_bug: treat_err_as_bug,
continue_after_error: Cell::new(true), continue_after_error: Cell::new(true),

View file

@ -53,7 +53,7 @@ impl JsonEmitter {
} }
impl Emitter for 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); let data = Diagnostic::from_diagnostic_builder(db, self);
if let Err(e) = writeln!(&mut self.dst, "{}", as_json(&data)) { if let Err(e) = writeln!(&mut self.dst, "{}", as_json(&data)) {
panic!("failed to print diagnostics: {:?}", e); panic!("failed to print diagnostics: {:?}", e);