File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1173,14 +1173,21 @@ pub(crate) fn is_simple_block_stmt(
1173
1173
&& attrs. map_or ( true , |a| a. is_empty ( ) )
1174
1174
}
1175
1175
1176
+ fn block_has_statements ( block : & ast:: Block ) -> bool {
1177
+ block
1178
+ . stmts
1179
+ . iter ( )
1180
+ . any ( |stmt| !matches ! ( stmt. kind, ast:: StmtKind :: Empty ) )
1181
+ }
1182
+
1176
1183
/// Checks whether a block contains no statements, expressions, comments, or
1177
1184
/// inner attributes.
1178
1185
pub ( crate ) fn is_empty_block (
1179
1186
context : & RewriteContext < ' _ > ,
1180
1187
block : & ast:: Block ,
1181
1188
attrs : Option < & [ ast:: Attribute ] > ,
1182
1189
) -> bool {
1183
- block . stmts . is_empty ( )
1190
+ ! block_has_statements ( & block )
1184
1191
&& !block_contains_comment ( context, block)
1185
1192
&& attrs. map_or ( true , |a| inner_attributes ( a) . is_empty ( ) )
1186
1193
}
You can’t perform that action at this time.
0 commit comments