@@ -559,24 +559,24 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
559
559
}
560
560
561
561
// check for never_loop
562
- never_loop:: check_never_loop ( cx, expr) ;
562
+ never_loop:: check ( cx, expr) ;
563
563
564
564
// check for `loop { if let {} else break }` that could be `while let`
565
565
// (also matches an explicit "match" instead of "if let")
566
566
// (even if the "match" or "if let" is used for declaration)
567
567
if let ExprKind :: Loop ( ref block, _, LoopSource :: Loop , _) = expr. kind {
568
568
// also check for empty `loop {}` statements, skipping those in #[panic_handler]
569
- empty_loop:: check_empty_loop ( cx, expr, block) ;
570
- while_let_loop:: check_while_let_loop ( cx, expr, block) ;
569
+ empty_loop:: check ( cx, expr, block) ;
570
+ while_let_loop:: check ( cx, expr, block) ;
571
571
}
572
572
573
- while_let_on_iterator:: check_while_let_on_iterator ( cx, expr) ;
573
+ while_let_on_iterator:: check ( cx, expr) ;
574
574
575
575
if let Some ( ( cond, body) ) = higher:: while_loop ( & expr) {
576
- while_immutable_condition:: check_infinite_loop ( cx, cond, body) ;
576
+ while_immutable_condition:: check ( cx, cond, body) ;
577
577
}
578
578
579
- needless_collect:: check_needless_collect ( expr, cx) ;
579
+ needless_collect:: check ( expr, cx) ;
580
580
}
581
581
}
582
582
@@ -588,17 +588,17 @@ fn check_for_loop<'tcx>(
588
588
expr : & ' tcx Expr < ' _ > ,
589
589
span : Span ,
590
590
) {
591
- let is_manual_memcpy_triggered = manual_memcpy:: detect_manual_memcpy ( cx, pat, arg, body, expr) ;
591
+ let is_manual_memcpy_triggered = manual_memcpy:: check ( cx, pat, arg, body, expr) ;
592
592
if !is_manual_memcpy_triggered {
593
- needless_range_loop:: check_for_loop_range ( cx, pat, arg, body, expr) ;
594
- explicit_counter_loop:: check_for_loop_explicit_counter ( cx, pat, arg, body, expr) ;
593
+ needless_range_loop:: check ( cx, pat, arg, body, expr) ;
594
+ explicit_counter_loop:: check ( cx, pat, arg, body, expr) ;
595
595
}
596
596
check_for_loop_arg ( cx, pat, arg, expr) ;
597
- for_kv_map:: check_for_loop_over_map_kv ( cx, pat, arg, body, expr) ;
598
- mut_range_bound:: check_for_mut_range_bound ( cx, arg, body) ;
599
- single_element_loop:: check_for_single_element_loop ( cx, pat, arg, body, expr) ;
600
- same_item_push:: detect_same_item_push ( cx, pat, arg, body, expr) ;
601
- manual_flatten:: check_manual_flatten ( cx, pat, arg, body, span) ;
597
+ for_kv_map:: check ( cx, pat, arg, body, expr) ;
598
+ mut_range_bound:: check ( cx, arg, body) ;
599
+ single_element_loop:: check ( cx, pat, arg, body, expr) ;
600
+ same_item_push:: check ( cx, pat, arg, body, expr) ;
601
+ manual_flatten:: check ( cx, pat, arg, body, span) ;
602
602
}
603
603
604
604
fn check_for_loop_arg ( cx : & LateContext < ' _ > , pat : & Pat < ' _ > , arg : & Expr < ' _ > , expr : & Expr < ' _ > ) {
@@ -610,13 +610,13 @@ fn check_for_loop_arg(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>, expr:
610
610
// check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
611
611
if method_name == "iter" || method_name == "iter_mut" {
612
612
if is_ref_iterable_type ( cx, & args[ 0 ] ) {
613
- explicit_iter_loop:: lint_iter_method ( cx, args, arg, method_name) ;
613
+ explicit_iter_loop:: check ( cx, args, arg, method_name) ;
614
614
}
615
615
} else if method_name == "into_iter" && match_trait_method ( cx, arg, & paths:: INTO_ITERATOR ) {
616
616
let receiver_ty = cx. typeck_results ( ) . expr_ty ( & args[ 0 ] ) ;
617
617
let receiver_ty_adjusted = cx. typeck_results ( ) . expr_ty_adjusted ( & args[ 0 ] ) ;
618
618
if TyS :: same_type ( receiver_ty, receiver_ty_adjusted) {
619
- explicit_into_iter_loop:: check_explicit_into_iter_loop ( cx, args, arg) ;
619
+ explicit_into_iter_loop:: check ( cx, args, arg) ;
620
620
} else {
621
621
let ref_receiver_ty = cx. tcx . mk_ref (
622
622
cx. tcx . lifetimes . re_erased ,
@@ -626,17 +626,17 @@ fn check_for_loop_arg(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>, expr:
626
626
} ,
627
627
) ;
628
628
if TyS :: same_type ( receiver_ty_adjusted, ref_receiver_ty) {
629
- explicit_iter_loop:: lint_iter_method ( cx, args, arg, method_name)
629
+ explicit_iter_loop:: check ( cx, args, arg, method_name)
630
630
}
631
631
}
632
632
} else if method_name == "next" && match_trait_method ( cx, arg, & paths:: ITERATOR ) {
633
- iter_next_loop:: lint ( cx, expr) ;
633
+ iter_next_loop:: check ( cx, expr) ;
634
634
next_loop_linted = true ;
635
635
}
636
636
}
637
637
}
638
638
if !next_loop_linted {
639
- for_loops_over_fallibles:: check_arg_type ( cx, pat, arg) ;
639
+ for_loops_over_fallibles:: check ( cx, pat, arg) ;
640
640
}
641
641
}
642
642
0 commit comments