@@ -3,7 +3,7 @@ use crate::utils::paths;
33use crate :: utils:: sugg:: Sugg ;
44use crate :: utils:: usage:: { is_unused, mutated_variables} ;
55use crate :: utils:: {
6- get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher, implements_trait,
6+ contains_name , get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher, implements_trait,
77 is_integer_const, is_no_std_crate, is_refutable, is_type_diagnostic_item, last_path_segment, match_trait_method,
88 match_type, match_var, multispan_sugg, qpath_res, snippet, snippet_opt, snippet_with_applicability,
99 snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, sugg,
@@ -1276,6 +1276,8 @@ fn check_for_loop_range<'tcx>(
12761276
12771277 let skip = if starts_at_zero {
12781278 String :: new ( )
1279+ } else if visitor. indexed_mut . contains ( & indexed) && contains_name ( indexed, start) {
1280+ return ;
12791281 } else {
12801282 format ! ( ".skip({})" , snippet( cx, start. span, ".." ) )
12811283 } ;
@@ -1302,6 +1304,8 @@ fn check_for_loop_range<'tcx>(
13021304
13031305 if is_len_call ( end, indexed) || is_end_eq_array_len ( cx, end, limits, indexed_ty) {
13041306 String :: new ( )
1307+ } else if visitor. indexed_mut . contains ( & indexed) && contains_name ( indexed, take_expr) {
1308+ return ;
13051309 } else {
13061310 match limits {
13071311 ast:: RangeLimits :: Closed => {
0 commit comments