Implement become expression formatting in rustfmt

This commit is contained in:
Maybe Waffle 2023-05-09 21:29:15 +00:00 committed by Caleb Cartwright
parent 1de65a2711
commit aa691480c0
2 changed files with 2 additions and 0 deletions

View File

@ -232,6 +232,7 @@ pub(crate) fn format_expr(
ast::ExprKind::Ret(Some(ref expr)) => { ast::ExprKind::Ret(Some(ref expr)) => {
rewrite_unary_prefix(context, "return ", &**expr, shape) rewrite_unary_prefix(context, "return ", &**expr, shape)
} }
ast::ExprKind::Become(ref expr) => rewrite_unary_prefix(context, "become ", &**expr, shape),
ast::ExprKind::Yeet(None) => Some("do yeet".to_owned()), ast::ExprKind::Yeet(None) => Some("do yeet".to_owned()),
ast::ExprKind::Yeet(Some(ref expr)) => { ast::ExprKind::Yeet(Some(ref expr)) => {
rewrite_unary_prefix(context, "do yeet ", &**expr, shape) rewrite_unary_prefix(context, "do yeet ", &**expr, shape)

View File

@ -505,6 +505,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
| ast::ExprKind::Range(..) | ast::ExprKind::Range(..)
| ast::ExprKind::Repeat(..) | ast::ExprKind::Repeat(..)
| ast::ExprKind::Ret(..) | ast::ExprKind::Ret(..)
| ast::ExprKind::Become(..)
| ast::ExprKind::Yeet(..) | ast::ExprKind::Yeet(..)
| ast::ExprKind::Tup(..) | ast::ExprKind::Tup(..)
| ast::ExprKind::Type(..) | ast::ExprKind::Type(..)