@@ -602,22 +602,19 @@ fn check_for_loop<'tcx>(
602
602
fn check_for_loop_arg ( cx : & LateContext < ' _ > , pat : & Pat < ' _ > , arg : & Expr < ' _ > , expr : & Expr < ' _ > ) {
603
603
let mut next_loop_linted = false ; // whether or not ITER_NEXT_LOOP lint was used
604
604
605
- if let ExprKind :: MethodCall ( method, _, args, _) = arg. kind {
606
- // just the receiver, no arguments
607
- if args. len ( ) == 1 {
608
- let method_name = & * method. ident . as_str ( ) ;
609
- // check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
610
- match method_name {
611
- "iter" | "iter_mut" => explicit_iter_loop:: check ( cx, args, arg, method_name) ,
612
- "into_iter" => {
613
- explicit_iter_loop:: check ( cx, args, arg, method_name) ;
614
- explicit_into_iter_loop:: check ( cx, args, arg) ;
615
- } ,
616
- "next" => {
617
- next_loop_linted = iter_next_loop:: check ( cx, arg, expr) ;
618
- } ,
619
- _ => { } ,
620
- }
605
+ if let ExprKind :: MethodCall ( method, _, [ self_arg] , _) = arg. kind {
606
+ let method_name = & * method. ident . as_str ( ) ;
607
+ // check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
608
+ match method_name {
609
+ "iter" | "iter_mut" => explicit_iter_loop:: check ( cx, self_arg, arg, method_name) ,
610
+ "into_iter" => {
611
+ explicit_iter_loop:: check ( cx, self_arg, arg, method_name) ;
612
+ explicit_into_iter_loop:: check ( cx, self_arg, arg) ;
613
+ } ,
614
+ "next" => {
615
+ next_loop_linted = iter_next_loop:: check ( cx, arg, expr) ;
616
+ } ,
617
+ _ => { } ,
621
618
}
622
619
}
623
620
0 commit comments