@@ -647,7 +647,7 @@ ast_struct! {
647
647
ast_struct ! {
648
648
/// A tuple expression: `(a, b, c, d)`.
649
649
#[ cfg_attr( docsrs, doc( cfg( feature = "full" ) ) ) ]
650
- pub struct ExprTuple #full {
650
+ pub struct ExprTuple {
651
651
pub attrs: Vec <Attribute >,
652
652
pub paren_token: token:: Paren ,
653
653
pub elems: Punctuated <Expr , Token ![ , ] >,
@@ -1111,13 +1111,13 @@ pub(crate) mod parsing {
1111
1111
use crate :: expr:: {
1112
1112
Arm , ExprArray , ExprAssign , ExprAsync , ExprAwait , ExprBlock , ExprBreak , ExprClosure ,
1113
1113
ExprConst , ExprContinue , ExprForLoop , ExprIf , ExprInfer , ExprLet , ExprLoop , ExprMatch ,
1114
- ExprRange , ExprRepeat , ExprReturn , ExprTry , ExprTryBlock , ExprTuple , ExprUnsafe , ExprWhile ,
1115
- ExprYield , Label , RangeLimits ,
1114
+ ExprRange , ExprRepeat , ExprReturn , ExprTry , ExprTryBlock , ExprUnsafe , ExprWhile , ExprYield ,
1115
+ Label , RangeLimits ,
1116
1116
} ;
1117
1117
use crate :: expr:: {
1118
1118
Expr , ExprBinary , ExprCall , ExprCast , ExprField , ExprGroup , ExprIndex , ExprLit , ExprMacro ,
1119
- ExprMethodCall , ExprParen , ExprPath , ExprReference , ExprStruct , ExprUnary , FieldValue ,
1120
- Index , Member ,
1119
+ ExprMethodCall , ExprParen , ExprPath , ExprReference , ExprStruct , ExprTuple , ExprUnary ,
1120
+ FieldValue , Index , Member ,
1121
1121
} ;
1122
1122
#[ cfg( feature = "full" ) ]
1123
1123
use crate :: ext:: IdentExt as _;
@@ -1807,7 +1807,7 @@ pub(crate) mod parsing {
1807
1807
} else if input. peek ( Lit ) {
1808
1808
input. parse ( ) . map ( Expr :: Lit )
1809
1809
} else if input. peek ( token:: Paren ) {
1810
- input . call ( expr_paren ) . map ( Expr :: Paren )
1810
+ paren_or_tuple ( input )
1811
1811
} else if input. peek ( Ident )
1812
1812
|| input. peek ( Token ! [ :: ] )
1813
1813
|| input. peek ( Token ! [ <] )
@@ -1911,7 +1911,6 @@ pub(crate) mod parsing {
1911
1911
}
1912
1912
}
1913
1913
1914
- #[ cfg( feature = "full" ) ]
1915
1914
fn paren_or_tuple ( input : ParseStream ) -> Result < Expr > {
1916
1915
let content;
1917
1916
let paren_token = parenthesized ! ( content in input) ;
@@ -2103,19 +2102,15 @@ pub(crate) mod parsing {
2103
2102
#[ cfg_attr( docsrs, doc( cfg( feature = "parsing" ) ) ) ]
2104
2103
impl Parse for ExprParen {
2105
2104
fn parse ( input : ParseStream ) -> Result < Self > {
2106
- expr_paren ( input)
2105
+ let content;
2106
+ Ok ( ExprParen {
2107
+ attrs : Vec :: new ( ) ,
2108
+ paren_token : parenthesized ! ( content in input) ,
2109
+ expr : content. parse ( ) ?,
2110
+ } )
2107
2111
}
2108
2112
}
2109
2113
2110
- fn expr_paren ( input : ParseStream ) -> Result < ExprParen > {
2111
- let content;
2112
- Ok ( ExprParen {
2113
- attrs : Vec :: new ( ) ,
2114
- paren_token : parenthesized ! ( content in input) ,
2115
- expr : content. parse ( ) ?,
2116
- } )
2117
- }
2118
-
2119
2114
#[ cfg( feature = "full" ) ]
2120
2115
#[ cfg_attr( docsrs, doc( cfg( feature = "parsing" ) ) ) ]
2121
2116
impl Parse for ExprLet {
@@ -3000,13 +2995,13 @@ pub(crate) mod printing {
3000
2995
use crate :: expr:: {
3001
2996
Arm , ExprArray , ExprAssign , ExprAsync , ExprAwait , ExprBlock , ExprBreak , ExprClosure ,
3002
2997
ExprConst , ExprContinue , ExprForLoop , ExprIf , ExprInfer , ExprLet , ExprLoop , ExprMatch ,
3003
- ExprRange , ExprRepeat , ExprReturn , ExprTry , ExprTryBlock , ExprTuple , ExprUnsafe , ExprWhile ,
3004
- ExprYield , Label , RangeLimits ,
2998
+ ExprRange , ExprRepeat , ExprReturn , ExprTry , ExprTryBlock , ExprUnsafe , ExprWhile , ExprYield ,
2999
+ Label , RangeLimits ,
3005
3000
} ;
3006
3001
use crate :: expr:: {
3007
3002
Expr , ExprBinary , ExprCall , ExprCast , ExprField , ExprGroup , ExprIndex , ExprLit , ExprMacro ,
3008
- ExprMethodCall , ExprParen , ExprPath , ExprReference , ExprStruct , ExprUnary , FieldValue ,
3009
- Index , Member ,
3003
+ ExprMethodCall , ExprParen , ExprPath , ExprReference , ExprStruct , ExprTuple , ExprUnary ,
3004
+ FieldValue , Index , Member ,
3010
3005
} ;
3011
3006
use crate :: fixup:: FixupContext ;
3012
3007
use crate :: op:: BinOp ;
@@ -3781,7 +3776,6 @@ pub(crate) mod printing {
3781
3776
}
3782
3777
}
3783
3778
3784
- #[ cfg( feature = "full" ) ]
3785
3779
#[ cfg_attr( docsrs, doc( cfg( feature = "printing" ) ) ) ]
3786
3780
impl ToTokens for ExprTuple {
3787
3781
fn to_tokens ( & self , tokens : & mut TokenStream ) {
0 commit comments