Skip to content

Commit

Permalink
feat: add initial support for ConstBlock expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed Oct 20, 2020
1 parent 041e41b commit cbe01e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/formatting/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
1 change: 1 addition & 0 deletions src/formatting/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand Down

0 comments on commit cbe01e4

Please sign in to comment.