Skip to content

Commit f7af36b

Browse files
Change expr_trailing_brace to an exhaustive match to force new expression kinds to specify whether they contain a brace
1 parent 2fdd9ed commit f7af36b

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

compiler/rustc_ast/src/util/classify.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,35 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
4848
}
4949
Gen(..) | Block(..) | ForLoop(..) | If(..) | Loop(..) | Match(..) | Struct(..)
5050
| TryBlock(..) | While(..) => break Some(expr),
51-
_ => break None,
51+
Break(_, _)
52+
| Range(_, _, _)
53+
| Ret(_)
54+
| Yield(_)
55+
| Array(_)
56+
| ConstBlock(_)
57+
| Call(_, _)
58+
| MethodCall(_)
59+
| Tup(_)
60+
| Lit(_)
61+
| Cast(_, _)
62+
| Type(_, _)
63+
| Await(_, _)
64+
| Field(_, _)
65+
| Index(_, _, _)
66+
| Underscore
67+
| Path(_, _)
68+
| Continue(_)
69+
| InlineAsm(_)
70+
| OffsetOf(_, _)
71+
| MacCall(_)
72+
| Repeat(_, _)
73+
| Paren(_)
74+
| Try(_)
75+
| Yeet(_)
76+
| Become(_)
77+
| IncludedBytes(_)
78+
| FormatArgs(_)
79+
| Err => break None, // _ => break None,
5280
}
5381
}
5482
}

0 commit comments

Comments
 (0)