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 ;
1
2
use rustc_ast:: { ast, ptr} ;
2
3
use rustc_span:: Span ;
3
4
use thin_vec:: thin_vec;
@@ -120,13 +121,8 @@ fn get_inner_expr<'a>(
120
121
expr
121
122
}
122
123
123
- fn iter_stmts_without_empty (
124
- stmts : & thin_vec:: ThinVec < ast:: Stmt > ,
125
- ) -> impl Iterator < Item = & ast:: Stmt > {
126
- stmts. iter ( ) . filter ( |x| match x. kind {
127
- crate :: ast:: StmtKind :: Empty => false ,
128
- _ => true ,
129
- } )
124
+ fn iter_stmts_without_empty ( stmts : & [ ast:: Stmt ] ) -> impl Iterator < Item = & ast:: Stmt > {
125
+ stmts. iter ( ) . filter ( |x| !matches ! ( x. kind, StmtKind :: Empty ) )
130
126
}
131
127
132
128
// 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