File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
Expand file tree Collapse file tree 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 {
138138 fn visit_expr ( & mut self , expr : & ' tcx Expr < ' tcx > ) -> ControlFlow < ( ) > {
139139 if expr. hir_id == self . hir_id {
140140 self . past_expr = true ;
141+ ControlFlow :: Continue ( ( ) )
141142 } else if self . past_expr {
142143 if matches ! ( & expr. kind, ExprKind :: Break ( ..) ) {
143144 self . break_after_expr = true ;
144145 }
145146
146147 return ControlFlow :: Break ( ( ) ) ;
148+ } else {
149+ intravisit:: walk_expr ( self , expr)
147150 }
148- intravisit:: walk_expr ( self , expr)
149151 }
150152}
Original file line number Diff line number Diff line change @@ -71,19 +71,13 @@ impl<'tcx> LateLintPass<'tcx> for UnusedPeekable {
7171 return ;
7272 }
7373
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 ( ) ) ;
7575
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 ;
8781 }
8882
8983 if !found_peek_call {
You can’t perform that action at this time.
0 commit comments