Skip to content

Commit 41110d6

Browse files
feat: add initial support for ConstBlock expressions
1 parent 28624ea commit 41110d6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/expr.rs

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ pub(crate) fn format_expr(
124124
| ast::ExprKind::Loop(..)
125125
| ast::ExprKind::While(..) => to_control_flow(expr, expr_type)
126126
.and_then(|control_flow| control_flow.rewrite(context, shape)),
127+
ast::ExprKind::ConstBlock(ref anon_const) => {
128+
Some(format!("const {}", anon_const.rewrite(context, shape)?))
129+
}
127130
ast::ExprKind::Block(ref block, opt_label) => {
128131
match expr_type {
129132
ExprType::Statement => {

src/utils.rs

+1
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
461461
| ast::ExprKind::While(..)
462462
| ast::ExprKind::If(..)
463463
| ast::ExprKind::Block(..)
464+
| ast::ExprKind::ConstBlock(..)
464465
| ast::ExprKind::Async(..)
465466
| ast::ExprKind::Loop(..)
466467
| ast::ExprKind::ForLoop(..)

0 commit comments

Comments
 (0)