File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,12 @@ impl Pass {
90
90
if let Some ( expr) = & block. expr {
91
91
Self :: expr_match ( cx, expr) ;
92
92
}
93
+ // only needed in the case of `break` with `;` at the end
94
+ else if let Some ( stmt) = block. stmts . last ( ) {
95
+ if let rustc:: hir:: StmtKind :: Semi ( expr, ..) = & stmt. node {
96
+ Self :: expr_match ( cx, expr) ;
97
+ }
98
+ }
93
99
} ,
94
100
// skip if it already has a return statement
95
101
ExprKind :: Ret ( ..) => ( ) ,
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ error: missing return statement
30
30
38 | true
31
31
| ^^^^ help: add `return` as shown: `return true`
32
32
33
+ error: missing return statement
34
+ --> $DIR/implicit_return.rs:46:9
35
+ |
36
+ 46 | break true;
37
+ | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
38
+
33
39
error: missing return statement
34
40
--> $DIR/implicit_return.rs:52:9
35
41
|
@@ -42,5 +48,5 @@ error: missing return statement
42
48
54 | let _ = || true;
43
49
| ^^^^ help: add `return` as shown: `return true`
44
50
45
- error: aborting due to 7 previous errors
51
+ error: aborting due to 8 previous errors
46
52
You can’t perform that action at this time.
0 commit comments