Refactor parse_expr_res.

This removes the final `Option<AttrWrapper>` argument.
This commit is contained in:
Nicholas Nethercote 2024-06-19 16:24:21 +10:00
parent 43eae4cef4
commit 8170acb197
5 changed files with 33 additions and 28 deletions

View file

@ -126,9 +126,9 @@ impl<'a> Parser<'a> {
// Remainder are line-expr stmts.
let e = match force_collect {
ForceCollect::Yes => self.collect_tokens_no_attrs(|this| {
this.parse_expr_res(Restrictions::STMT_EXPR, Some(attrs))
this.parse_expr_res(Restrictions::STMT_EXPR, attrs)
})?,
ForceCollect::No => self.parse_expr_res(Restrictions::STMT_EXPR, Some(attrs))?,
ForceCollect::No => self.parse_expr_res(Restrictions::STMT_EXPR, attrs)?,
};
if matches!(e.kind, ExprKind::Assign(..)) && self.eat_keyword(kw::Else) {
let bl = self.parse_block()?;