Skip to content

Commit 6f112be

Browse files
committed
Use maybe_whole! to streamline parse_stmt_without_recovery.
1 parent 1f958e8 commit 6f112be

File tree

1 file changed

+3
-9
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+3
-9
lines changed

compiler/rustc_parse/src/parser/stmt.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,12 @@ impl<'a> Parser<'a> {
5151
let attrs = self.parse_outer_attributes()?;
5252
let lo = self.token.span;
5353

54-
// Don't use `maybe_whole` so that we have precise control
55-
// over when we bump the parser
56-
if let token::Interpolated(nt) = &self.token.kind
57-
&& let token::NtStmt(stmt) = &nt.0
58-
{
59-
let mut stmt = stmt.clone();
60-
self.bump();
54+
maybe_whole!(self, NtStmt, |mut stmt| {
6155
stmt.visit_attrs(|stmt_attrs| {
6256
attrs.prepend_to_nt_inner(stmt_attrs);
6357
});
64-
return Ok(Some(stmt.into_inner()));
65-
}
58+
Some(stmt.into_inner())
59+
});
6660

6761
if self.token.is_keyword(kw::Mut) && self.is_keyword_ahead(1, &[kw::Let]) {
6862
self.bump();

0 commit comments

Comments
 (0)