Use Option::map_or instead of .map(..).unwrap_or(..)
This commit is contained in:
@@ -804,7 +804,7 @@ impl HandlerInner {
|
||||
}
|
||||
|
||||
fn treat_err_as_bug(&self) -> bool {
|
||||
self.flags.treat_err_as_bug.map(|c| self.err_count() >= c).unwrap_or(false)
|
||||
self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() >= c)
|
||||
}
|
||||
|
||||
fn print_error_count(&mut self, registry: &Registry) {
|
||||
@@ -913,7 +913,7 @@ impl HandlerInner {
|
||||
// This is technically `self.treat_err_as_bug()` but `delay_span_bug` is called before
|
||||
// incrementing `err_count` by one, so we need to +1 the comparing.
|
||||
// FIXME: Would be nice to increment err_count in a more coherent way.
|
||||
if self.flags.treat_err_as_bug.map(|c| self.err_count() + 1 >= c).unwrap_or(false) {
|
||||
if self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() + 1 >= c) {
|
||||
// FIXME: don't abort here if report_delayed_bugs is off
|
||||
self.span_bug(sp, msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user