@@ -161,7 +161,7 @@ impl<'a> Parser<'a> {
161
161
( Ident :: invalid ( ) , ItemKind :: Use ( P ( tree) ) )
162
162
} else if self . check_fn_front_matter ( ) {
163
163
// FUNCTION ITEM
164
- let ( ident, sig, generics, body) = self . parse_fn ( & mut false , attrs, req_name) ?;
164
+ let ( ident, sig, generics, body) = self . parse_fn ( attrs, req_name) ?;
165
165
( ident, ItemKind :: Fn ( sig, generics, body) )
166
166
} else if self . eat_keyword ( kw:: Extern ) {
167
167
if self . eat_keyword ( kw:: Crate ) {
@@ -1406,7 +1406,6 @@ impl<'a> Parser<'a> {
1406
1406
/// Parse a function starting from the front matter (`const ...`) to the body `{ ... }` or `;`.
1407
1407
fn parse_fn (
1408
1408
& mut self ,
1409
- at_end : & mut bool ,
1410
1409
attrs : & mut Vec < Attribute > ,
1411
1410
req_name : ReqName ,
1412
1411
) -> PResult < ' a , ( Ident , FnSig , Generics , Option < P < Block > > ) > {
@@ -1415,18 +1414,14 @@ impl<'a> Parser<'a> {
1415
1414
let mut generics = self . parse_generics ( ) ?; // `<'a, T, ...>`
1416
1415
let decl = self . parse_fn_decl ( req_name, AllowPlus :: Yes ) ?; // `(p: u8, ...)`
1417
1416
generics. where_clause = self . parse_where_clause ( ) ?; // `where T: Ord`
1418
- let body = self . parse_fn_body ( at_end , attrs) ?; // `;` or `{ ... }`.
1417
+ let body = self . parse_fn_body ( attrs) ?; // `;` or `{ ... }`.
1419
1418
Ok ( ( ident, FnSig { header, decl } , generics, body) )
1420
1419
}
1421
1420
1422
1421
/// Parse the "body" of a function.
1423
1422
/// This can either be `;` when there's no body,
1424
1423
/// or e.g. a block when the function is a provided one.
1425
- fn parse_fn_body (
1426
- & mut self ,
1427
- at_end : & mut bool ,
1428
- attrs : & mut Vec < Attribute > ,
1429
- ) -> PResult < ' a , Option < P < Block > > > {
1424
+ fn parse_fn_body ( & mut self , attrs : & mut Vec < Attribute > ) -> PResult < ' a , Option < P < Block > > > {
1430
1425
let ( inner_attrs, body) = match self . token . kind {
1431
1426
token:: Semi => {
1432
1427
self . bump ( ) ;
@@ -1446,7 +1441,6 @@ impl<'a> Parser<'a> {
1446
1441
_ => return self . expected_semi_or_open_brace ( ) ,
1447
1442
} ;
1448
1443
attrs. extend ( inner_attrs) ;
1449
- * at_end = true ;
1450
1444
Ok ( body)
1451
1445
}
1452
1446
0 commit comments