We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
parse_dot_or_call_expr_with
1 parent 9833b71 commit 745ad84Copy full SHA for 745ad84
compiler/rustc_parse/src/parser/expr.rs
@@ -944,13 +944,18 @@ impl<'a> Parser<'a> {
944
// Stitch the list of outer attributes onto the return value.
945
// A little bit ugly, but the best way given the current code
946
// 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
+ let res = self.parse_dot_or_call_expr_with_(e0, lo);
+ if attrs.is_empty() {
+ res
+ } else {
+ res.map(|expr| {
952
+ expr.map(|mut expr| {
953
+ attrs.extend(expr.attrs);
954
+ expr.attrs = attrs;
955
+ expr
956
+ })
957
})
- })
958
+ }
959
}
960
961
fn parse_dot_or_call_expr_with_(&mut self, mut e: P<Expr>, lo: Span) -> PResult<'a, P<Expr>> {
0 commit comments