Skip to content

Commit 251a3a9

Browse files
refactor: cleanup block check for statements
1 parent fd417fe commit 251a3a9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/formatting/expr.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,18 +1206,10 @@ pub(crate) fn is_simple_block_stmt(
12061206
}
12071207

12081208
fn block_has_statements(block: &ast::Block) -> bool {
1209-
block.stmts.iter().any(|stmt| match stmt.kind {
1210-
ast::StmtKind::Semi(ref expr) => {
1211-
if let ast::ExprKind::Tup(ref tup_exprs) = expr.kind {
1212-
if tup_exprs.is_empty() {
1213-
return false;
1214-
}
1215-
}
1216-
true
1217-
}
1218-
ast::StmtKind::Empty => false,
1219-
_ => true,
1220-
})
1209+
!block
1210+
.stmts
1211+
.iter()
1212+
.all(|stmt| matches!(stmt.kind, ast::StmtKind::Empty))
12211213
}
12221214

12231215
/// Checks whether a block contains no statements, expressions, comments, or

0 commit comments

Comments
 (0)