diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-01-15 18:26:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-15 18:26:14 +0900 |
| commit | a584d874172b85d854f2e4d2a3256f7c23e3183a (patch) | |
| tree | a19e9e1e49c0735828c8ababae5bacb827ce814c /compiler/rustc_errors/src | |
| parent | 1b8fd02daab85e129f0dda9c92ea11aaa14b7485 (diff) | |
| parent | a56bffb4f9d6f7791b2fa40412bd3e0549d76cc3 (diff) | |
| download | rust-a584d874172b85d854f2e4d2a3256f7c23e3183a.tar.gz rust-a584d874172b85d854f2e4d2a3256f7c23e3183a.zip | |
Rollup merge of #80944 - LingMan:map_or, r=nagisa
Use Option::map_or instead of `.map(..).unwrap_or(..)` ``@rustbot`` modify labels +C-cleanup +T-compiler
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 593e0d92031..e184e929b07 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -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); } |
