diff options
| author | bors <bors@rust-lang.org> | 2023-05-25 00:33:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-25 00:33:43 +0000 |
| commit | 7664dfe4331265d0b2b1ffb89c92d443886bec0b (patch) | |
| tree | 09c5b7ca62f2202c566ff9a70760ce4284646506 /compiler/rustc_errors | |
| parent | 096309e6dc4378e175e524e963332d1a3830ed63 (diff) | |
| parent | 8038606bf32df8595811176e7299ef88133f9c92 (diff) | |
| download | rust-7664dfe4331265d0b2b1ffb89c92d443886bec0b.tar.gz rust-7664dfe4331265d0b2b1ffb89c92d443886bec0b.zip | |
Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth
Rollup of 5 pull requests Successful merges: - #111741 (Use `ObligationCtxt` in custom type ops) - #111840 (Expose more information in `get_body_with_borrowck_facts`) - #111876 (Roll compiler_builtins to 0.1.92) - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler ) - #111915 (libtest: Improve error when missing `-Zunstable-options`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 4 |
2 files changed, 7 insertions, 11 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 3e38d6afb0b..6d944e51314 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -285,15 +285,11 @@ pub trait Emitter: Translate { format!( "help: {}{}: `{}`", &msg, - if self - .source_map() - .map(|sm| is_case_difference( - sm, - substitution, - sugg.substitutions[0].parts[0].span, - )) - .unwrap_or(false) - { + if self.source_map().is_some_and(|sm| is_case_difference( + sm, + substitution, + sugg.substitutions[0].parts[0].span, + )) { " (notice the capitalization)" } else { "" diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 074fbb1322c..3dec0d9299c 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1437,7 +1437,7 @@ impl HandlerInner { } fn treat_err_as_bug(&self) -> bool { - self.flags.treat_err_as_bug.map_or(false, |c| { + self.flags.treat_err_as_bug.is_some_and(|c| { self.err_count() + self.lint_err_count + self.delayed_bug_count() >= c.get() }) } @@ -1603,7 +1603,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_or(false, |c| { + if self.flags.treat_err_as_bug.is_some_and(|c| { self.err_count() + self.lint_err_count + self.delayed_bug_count() + 1 >= c.get() }) { // FIXME: don't abort here if report_delayed_bugs is off |
