Skip to content

Commit f647c11

Browse files
committed
simplify parse_fn_block_decl
1 parent ad6f91a commit f647c11

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/librustc_parse/parser/expr.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,26 +1360,24 @@ impl<'a> Parser<'a> {
13601360

13611361
/// Parses the `|arg, arg|` header of a closure.
13621362
fn parse_fn_block_decl(&mut self) -> PResult<'a, P<FnDecl>> {
1363-
let inputs_captures = {
1364-
if self.eat(&token::OrOr) {
1365-
Vec::new()
1366-
} else {
1367-
self.expect(&token::BinOp(token::Or))?;
1368-
let args = self
1369-
.parse_seq_to_before_tokens(
1370-
&[&token::BinOp(token::Or), &token::OrOr],
1371-
SeqSep::trailing_allowed(token::Comma),
1372-
TokenExpectType::NoExpect,
1373-
|p| p.parse_fn_block_param(),
1374-
)?
1375-
.0;
1376-
self.expect_or()?;
1377-
args
1378-
}
1363+
let inputs = if self.eat(&token::OrOr) {
1364+
Vec::new()
1365+
} else {
1366+
self.expect(&token::BinOp(token::Or))?;
1367+
let args = self
1368+
.parse_seq_to_before_tokens(
1369+
&[&token::BinOp(token::Or), &token::OrOr],
1370+
SeqSep::trailing_allowed(token::Comma),
1371+
TokenExpectType::NoExpect,
1372+
|p| p.parse_fn_block_param(),
1373+
)?
1374+
.0;
1375+
self.expect_or()?;
1376+
args
13791377
};
13801378
let output = self.parse_ret_ty(true, true)?;
13811379

1382-
Ok(P(FnDecl { inputs: inputs_captures, output }))
1380+
Ok(P(FnDecl { inputs, output }))
13831381
}
13841382

13851383
/// Parses a parameter in a closure header (e.g., `|arg, arg|`).

0 commit comments

Comments
 (0)