]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebank
authorYuki Okushi <jtitor@2k36.org>
Wed, 1 Jun 2022 21:44:27 +0000 (06:44 +0900)
committerGitHub <noreply@github.com>
Wed, 1 Jun 2022 21:44:27 +0000 (06:44 +0900)
commitd126de111bdf74cbcd20f043139af4f1e57b3cba
treec4898d93146c2adc40885e5185086030dd450160
parent9fc3fc3a0cf63b9be317f92b84dcaa9b20162279
parent7b6c5c76a5b4b1a7676f7792c92939c4a7e85f5b
Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebank

Move conditions out of recover/report functions.

`Parser` has six recover/report functions that are passed a boolean, and
nothing is done if the boolean has a particular value.

This PR moves the tests outside the functions. This has the following effects.
- The number of lines of code goes down.
- Some `use` items become shorter.
- Avoids the strangeness whereby 11 out of 12 calls to
  `maybe_recover_from_bad_qpath` pass `true` as the second argument.
- Makes it clear at the call site that only one of
  `maybe_recover_from_bad_type_plus` and `maybe_report_ambiguous_plus` will be
  run.

r? `@estebank`
compiler/rustc_parse/src/parser/diagnostics.rs
compiler/rustc_parse/src/parser/expr.rs
compiler/rustc_parse/src/parser/stmt.rs
compiler/rustc_parse/src/parser/ty.rs