From 30b6c59f24cfb0e451e3df14ef536e4e40fe2672 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sat, 22 Jun 2019 12:44:03 +0100 Subject: Prefer to use `has_errors` to `err_count` --- src/librustc_errors/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 05cee6dff23..082f981338a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -352,7 +352,7 @@ pub struct HandlerFlags { impl Drop for Handler { fn drop(&mut self) { - if self.err_count() == 0 { + if !self.has_errors() { let mut bugs = self.delayed_span_bugs.borrow_mut(); let has_bugs = !bugs.is_empty(); for bug in bugs.drain(..) { @@ -705,10 +705,9 @@ impl Handler { } pub fn abort_if_errors(&self) { - if self.err_count() == 0 { - return; + if self.has_errors() { + FatalError.raise(); } - FatalError.raise(); } pub fn emit(&self, msp: &MultiSpan, msg: &str, lvl: Level) { if lvl == Warning && !self.flags.can_emit_warnings { -- cgit 1.4.1-3-g733a5