diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-06-22 12:44:03 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-06-22 15:36:24 +0100 |
| commit | 30b6c59f24cfb0e451e3df14ef536e4e40fe2672 (patch) | |
| tree | 3ccccdaa0ac46bb15ce6331c114f70a0ddbc05f7 /src/librustc_errors | |
| parent | f693d339f175b3aa23a91c62632c5f0c86886059 (diff) | |
| download | rust-30b6c59f24cfb0e451e3df14ef536e4e40fe2672.tar.gz rust-30b6c59f24cfb0e451e3df14ef536e4e40fe2672.zip | |
Prefer to use `has_errors` to `err_count`
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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 { |
