@@ -25,6 +25,7 @@ mod while_let_on_iterator;
2525use clippy_config:: msrvs:: Msrv ;
2626use clippy_config:: Conf ;
2727use clippy_utils:: higher;
28+ use rustc_ast:: Label ;
2829use rustc_hir:: { Expr , ExprKind , LoopSource , Pat } ;
2930use rustc_lint:: { LateContext , LateLintPass } ;
3031use rustc_session:: impl_lint_pass;
@@ -760,6 +761,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
760761 body,
761762 loop_id,
762763 span,
764+ label,
763765 } ) = for_loop
764766 {
765767 // we don't want to check expanded macros
@@ -768,7 +770,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
768770 if body. span . from_expansion ( ) {
769771 return ;
770772 }
771- self . check_for_loop ( cx, pat, arg, body, expr, span) ;
773+ self . check_for_loop ( cx, pat, arg, body, expr, span, label ) ;
772774 if let ExprKind :: Block ( block, _) = body. kind {
773775 never_loop:: check ( cx, block, loop_id, span, for_loop. as_ref ( ) ) ;
774776 }
@@ -808,6 +810,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
808810}
809811
810812impl Loops {
813+ #[ allow( clippy:: too_many_arguments) ]
811814 fn check_for_loop < ' tcx > (
812815 & self ,
813816 cx : & LateContext < ' tcx > ,
@@ -816,11 +819,12 @@ impl Loops {
816819 body : & ' tcx Expr < ' _ > ,
817820 expr : & ' tcx Expr < ' _ > ,
818821 span : Span ,
822+ label : Option < Label > ,
819823 ) {
820824 let is_manual_memcpy_triggered = manual_memcpy:: check ( cx, pat, arg, body, expr) ;
821825 if !is_manual_memcpy_triggered {
822826 needless_range_loop:: check ( cx, pat, arg, body, expr) ;
823- explicit_counter_loop:: check ( cx, pat, arg, body, expr) ;
827+ explicit_counter_loop:: check ( cx, pat, arg, body, expr, label ) ;
824828 }
825829 self . check_for_loop_arg ( cx, pat, arg) ;
826830 for_kv_map:: check ( cx, pat, arg, body) ;
0 commit comments