@@ -75,25 +75,6 @@ pub(super) enum LhsExpr {
7575 AlreadyParsed { expr : P < Expr > , starts_statement : bool } ,
7676}
7777
78- impl From < Option < AttrWrapper > > for LhsExpr {
79- /// Converts `Some(attrs)` into `LhsExpr::AttributesParsed(attrs)`
80- /// and `None` into `LhsExpr::NotYetParsed`.
81- ///
82- /// This conversion does not allocate.
83- fn from ( o : Option < AttrWrapper > ) -> Self {
84- if let Some ( attrs) = o { LhsExpr :: AttributesParsed ( attrs) } else { LhsExpr :: NotYetParsed }
85- }
86- }
87-
88- impl From < P < Expr > > for LhsExpr {
89- /// Converts the `expr: P<Expr>` into `LhsExpr::AlreadyParsed { expr, starts_statement: false }`.
90- ///
91- /// This conversion does not allocate.
92- fn from ( expr : P < Expr > ) -> Self {
93- LhsExpr :: AlreadyParsed { expr, starts_statement : false }
94- }
95- }
96-
9778#[ derive( Debug ) ]
9879enum DestructuredFloat {
9980 /// 1e2
@@ -166,7 +147,11 @@ impl<'a> Parser<'a> {
166147 & mut self ,
167148 already_parsed_attrs : Option < AttrWrapper > ,
168149 ) -> PResult < ' a , P < Expr > > {
169- self . parse_expr_assoc_with ( 0 , already_parsed_attrs. into ( ) )
150+ let lhs = match already_parsed_attrs {
151+ Some ( attrs) => LhsExpr :: AttributesParsed ( attrs) ,
152+ None => LhsExpr :: NotYetParsed ,
153+ } ;
154+ self . parse_expr_assoc_with ( 0 , lhs)
170155 }
171156
172157 /// Parses an associative expression with operators of at least `min_prec` precedence.
@@ -2660,7 +2645,8 @@ impl<'a> Parser<'a> {
26602645 } else {
26612646 self . expect ( & token:: Eq ) ?;
26622647 }
2663- let expr = self . parse_expr_assoc_with ( 1 + prec_let_scrutinee_needs_par ( ) , None . into ( ) ) ?;
2648+ let expr =
2649+ self . parse_expr_assoc_with ( 1 + prec_let_scrutinee_needs_par ( ) , LhsExpr :: NotYetParsed ) ?;
26642650 let span = lo. to ( expr. span ) ;
26652651 Ok ( self . mk_expr ( span, ExprKind :: Let ( pat, expr, span, recovered) ) )
26662652 }
0 commit comments