about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-14 07:07:30 +0000
committerbors <bors@rust-lang.org>2024-09-14 07:07:30 +0000
commit583f358e940574f3de235b1c7bf90353c68a7f08 (patch)
tree3eb940125a277d2f3b0e6eaf9a84c1efed1cbf63 /compiler/rustc_parse/src/parser/expr.rs
parent20862e4653ece8bad3a263431e602cbf25982e44 (diff)
parent94d49917ad3a88efffa3ad0e2d2dd95e1f866997 (diff)
downloadrust-583f358e940574f3de235b1c7bf90353c68a7f08.tar.gz
rust-583f358e940574f3de235b1c7bf90353c68a7f08.zip
Auto merge of #3885 - rust-lang:rustup-2024-09-14, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ecc4cd96faf..2d6edad2977 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2554,13 +2554,12 @@ impl<'a> Parser<'a> {
             let maybe_fatarrow = self.token.clone();
             let block = if self.check(&token::OpenDelim(Delimiter::Brace)) {
                 self.parse_block()?
+            } else if let Some(block) = recover_block_from_condition(self) {
+                block
             } else {
-                if let Some(block) = recover_block_from_condition(self) {
-                    block
-                } else {
-                    self.error_on_extra_if(&cond)?;
-                    // Parse block, which will always fail, but we can add a nice note to the error
-                    self.parse_block().map_err(|mut err| {
+                self.error_on_extra_if(&cond)?;
+                // Parse block, which will always fail, but we can add a nice note to the error
+                self.parse_block().map_err(|mut err| {
                         if self.prev_token == token::Semi
                             && self.token == token::AndAnd
                             && let maybe_let = self.look_ahead(1, |t| t.clone())
@@ -2592,7 +2591,6 @@ impl<'a> Parser<'a> {
                         }
                         err
                     })?
-                }
             };
             self.error_on_if_block_attrs(lo, false, block.span, attrs);
             block