File tree 2 files changed +9
-13
lines changed
2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -138,13 +138,15 @@ impl<'tcx> Visitor<'tcx> for BreakAfterExprVisitor {
138
138
fn visit_expr ( & mut self , expr : & ' tcx Expr < ' tcx > ) -> ControlFlow < ( ) > {
139
139
if expr. hir_id == self . hir_id {
140
140
self . past_expr = true ;
141
+ ControlFlow :: Continue ( ( ) )
141
142
} else if self . past_expr {
142
143
if matches ! ( & expr. kind, ExprKind :: Break ( ..) ) {
143
144
self . break_after_expr = true ;
144
145
}
145
146
146
147
return ControlFlow :: Break ( ( ) ) ;
148
+ } else {
149
+ intravisit:: walk_expr ( self , expr)
147
150
}
148
- intravisit:: walk_expr ( self , expr)
149
151
}
150
152
}
Original file line number Diff line number Diff line change @@ -71,19 +71,13 @@ impl<'tcx> LateLintPass<'tcx> for UnusedPeekable {
71
71
return ;
72
72
}
73
73
74
- let mut found_peek_call = false ;
74
+ let mut found_peek_call = block . stmts [ idx.. ] . iter ( ) . any ( |stmt| vis . visit_stmt ( stmt ) . is_break ( ) ) ;
75
75
76
- for stmt in & block. stmts [ idx..] {
77
- if vis. visit_stmt ( stmt) . is_break ( ) {
78
- found_peek_call = true ;
79
- break ;
80
- }
81
- }
82
-
83
- if !found_peek_call && let Some ( expr) = block. expr {
84
- if vis. visit_expr ( expr) . is_break ( ) {
85
- found_peek_call = true
86
- }
76
+ if !found_peek_call
77
+ && let Some ( expr) = block. expr
78
+ && vis. visit_expr ( expr) . is_break ( )
79
+ {
80
+ found_peek_call = true ;
87
81
}
88
82
89
83
if !found_peek_call {
You can’t perform that action at this time.
0 commit comments