about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-06 23:35:48 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-23 13:43:21 +0100
commitf647c11121bcaff1a9006b7d04cd52331f1be869 (patch)
treee5475032499d14194bb37d1ea3c15c999bb191d4 /src/librustc_parse/parser
parentad6f91a4223974cdafed923658e38f7952638bb7 (diff)
downloadrust-f647c11121bcaff1a9006b7d04cd52331f1be869.tar.gz
rust-f647c11121bcaff1a9006b7d04cd52331f1be869.zip
simplify parse_fn_block_decl
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/expr.rs32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index ce0a3e18877..acc7bfd3f8a 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -1360,26 +1360,24 @@ impl<'a> Parser<'a> {
 
     /// Parses the `|arg, arg|` header of a closure.
     fn parse_fn_block_decl(&mut self) -> PResult<'a, P<FnDecl>> {
-        let inputs_captures = {
-            if self.eat(&token::OrOr) {
-                Vec::new()
-            } else {
-                self.expect(&token::BinOp(token::Or))?;
-                let args = self
-                    .parse_seq_to_before_tokens(
-                        &[&token::BinOp(token::Or), &token::OrOr],
-                        SeqSep::trailing_allowed(token::Comma),
-                        TokenExpectType::NoExpect,
-                        |p| p.parse_fn_block_param(),
-                    )?
-                    .0;
-                self.expect_or()?;
-                args
-            }
+        let inputs = if self.eat(&token::OrOr) {
+            Vec::new()
+        } else {
+            self.expect(&token::BinOp(token::Or))?;
+            let args = self
+                .parse_seq_to_before_tokens(
+                    &[&token::BinOp(token::Or), &token::OrOr],
+                    SeqSep::trailing_allowed(token::Comma),
+                    TokenExpectType::NoExpect,
+                    |p| p.parse_fn_block_param(),
+                )?
+                .0;
+            self.expect_or()?;
+            args
         };
         let output = self.parse_ret_ty(true, true)?;
 
-        Ok(P(FnDecl { inputs: inputs_captures, output }))
+        Ok(P(FnDecl { inputs, output }))
     }
 
     /// Parses a parameter in a closure header (e.g., `|arg, arg|`).