diff --git a/src/formatting/expr.rs b/src/formatting/expr.rs index b53496affa8..61937aeee3f 100644 --- a/src/formatting/expr.rs +++ b/src/formatting/expr.rs @@ -124,6 +124,9 @@ pub(crate) fn format_expr( | ast::ExprKind::Loop(..) | ast::ExprKind::While(..) => to_control_flow(expr, expr_type) .and_then(|control_flow| control_flow.rewrite(context, shape)), + ast::ExprKind::ConstBlock(ref anon_const) => { + Some(format!("const {}", anon_const.rewrite(context, shape)?)) + } ast::ExprKind::Block(ref block, opt_label) => { match expr_type { ExprType::Statement => { diff --git a/src/formatting/utils.rs b/src/formatting/utils.rs index f3484020b05..01d4c4b202f 100644 --- a/src/formatting/utils.rs +++ b/src/formatting/utils.rs @@ -482,6 +482,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr | ast::ExprKind::While(..) | ast::ExprKind::If(..) | ast::ExprKind::Block(..) + | ast::ExprKind::ConstBlock(..) | ast::ExprKind::Async(..) | ast::ExprKind::Loop(..) | ast::ExprKind::ForLoop(..)