Skip to content

Commit 71d9fed

Browse files
committed
support ast::ExprKind::Move in rustfmt
1 parent 1203e52 commit 71d9fed

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/tools/rustfmt/src/expr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ pub(crate) fn format_expr(
125125
let callee_str = callee.rewrite_result(context, shape)?;
126126
rewrite_call(context, &callee_str, args, inner_span, shape)
127127
}
128+
ast::ExprKind::Move(ref subexpr, move_kw_span) => {
129+
let inner_span = mk_sp(move_kw_span.hi(), expr.span.hi());
130+
rewrite_call(context, "move", std::slice::from_ref(subexpr), inner_span, shape)
131+
}
128132
ast::ExprKind::Paren(ref subexpr) => rewrite_paren(context, subexpr, shape, expr.span),
129133
ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
130134
// FIXME: format comments between operands and operator

src/tools/rustfmt/src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
553553
| ast::ExprKind::Field(..)
554554
| ast::ExprKind::IncludedBytes(..)
555555
| ast::ExprKind::InlineAsm(..)
556+
| ast::ExprKind::Move(..)
556557
| ast::ExprKind::OffsetOf(..)
557558
| ast::ExprKind::UnsafeBinderCast(..)
558559
| ast::ExprKind::Let(..)

0 commit comments

Comments
 (0)