File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -944,13 +944,18 @@ impl<'a> Parser<'a> {
944944 // Stitch the list of outer attributes onto the return value.
945945 // A little bit ugly, but the best way given the current code
946946 // structure
947- self . parse_dot_or_call_expr_with_ ( e0, lo) . map ( |expr| {
948- expr. map ( |mut expr| {
949- attrs. extend ( expr. attrs ) ;
950- expr. attrs = attrs;
951- expr
947+ let res = self . parse_dot_or_call_expr_with_ ( e0, lo) ;
948+ if attrs. is_empty ( ) {
949+ res
950+ } else {
951+ res. map ( |expr| {
952+ expr. map ( |mut expr| {
953+ attrs. extend ( expr. attrs ) ;
954+ expr. attrs = attrs;
955+ expr
956+ } )
952957 } )
953- } )
958+ }
954959 }
955960
956961 fn parse_dot_or_call_expr_with_ ( & mut self , mut e : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
You can’t perform that action at this time.
0 commit comments