File tree Expand file tree Collapse file tree 7 files changed +41
-7
lines changed Expand file tree Collapse file tree 7 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 1+ use rustc_ast:: ast:: StmtKind ;
12use rustc_ast:: { ast, ptr} ;
23use rustc_span:: Span ;
34use thin_vec:: thin_vec;
@@ -119,13 +120,8 @@ fn get_inner_expr<'a>(
119120 expr
120121}
121122
122- fn iter_stmts_without_empty (
123- stmts : & thin_vec:: ThinVec < ast:: Stmt > ,
124- ) -> impl Iterator < Item = & ast:: Stmt > {
125- stmts. iter ( ) . filter ( |x| match x. kind {
126- crate :: ast:: StmtKind :: Empty => false ,
127- _ => true ,
128- } )
123+ fn iter_stmts_without_empty ( stmts : & [ ast:: Stmt ] ) -> impl Iterator < Item = & ast:: Stmt > {
124+ stmts. iter ( ) . filter ( |x| !matches ! ( x. kind, StmtKind :: Empty ) )
129125}
130126
131127// Figure out if a block is necessary.
Original file line number Diff line number Diff line change 1+ fn bar ( ) -> fn ( i32 ) -> i32 {
2+ |a| {
3+ ;
4+ a;
5+ b
6+ }
7+ }
8+
Original file line number Diff line number Diff line change 1+ fn foo ( ) -> fn ( i32 ) -> i32 {
2+ |a| {
3+ ;
4+ ;
5+ ; ; ; ;
6+ a
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ fn foo ( ) -> fn ( i32 ) -> i32 {
2+ |a| {
3+ /*comment before empty statement */ ;
4+ a
5+ }
6+ }
7+
Original file line number Diff line number Diff line change 1+ fn bar ( ) -> fn ( i32 ) -> i32 {
2+ |a| {
3+ a;
4+ b
5+ }
6+ }
Original file line number Diff line number Diff line change 1+ fn foo ( ) -> fn ( i32 ) -> i32 {
2+ |a| a
3+ }
Original file line number Diff line number Diff line change 1+ fn foo ( ) -> fn ( i32 ) -> i32 {
2+ |a| {
3+ /*comment before empty statement */
4+ a
5+ }
6+ }
You can’t perform that action at this time.
0 commit comments