@@ -75,25 +75,6 @@ pub(super) enum LhsExpr {
75
75
AlreadyParsed { expr : P < Expr > , starts_statement : bool } ,
76
76
}
77
77
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
-
97
78
#[ derive( Debug ) ]
98
79
enum DestructuredFloat {
99
80
/// 1e2
@@ -166,7 +147,11 @@ impl<'a> Parser<'a> {
166
147
& mut self ,
167
148
already_parsed_attrs : Option < AttrWrapper > ,
168
149
) -> 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)
170
155
}
171
156
172
157
/// Parses an associative expression with operators of at least `min_prec` precedence.
@@ -2660,7 +2645,8 @@ impl<'a> Parser<'a> {
2660
2645
} else {
2661
2646
self . expect ( & token:: Eq ) ?;
2662
2647
}
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 ) ?;
2664
2650
let span = lo. to ( expr. span ) ;
2665
2651
Ok ( self . mk_expr ( span, ExprKind :: Let ( pat, expr, span, recovered) ) )
2666
2652
}
0 commit comments