@@ -3,7 +3,7 @@ use crate::utils::paths;
3
3
use crate :: utils:: sugg:: Sugg ;
4
4
use crate :: utils:: usage:: { is_unused, mutated_variables} ;
5
5
use 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,
7
7
is_integer_const, is_no_std_crate, is_refutable, is_type_diagnostic_item, last_path_segment, match_trait_method,
8
8
match_type, match_var, multispan_sugg, qpath_res, snippet, snippet_opt, snippet_with_applicability,
9
9
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>(
1276
1276
1277
1277
let skip = if starts_at_zero {
1278
1278
String :: new ( )
1279
+ } else if visitor. indexed_mut . contains ( & indexed) && contains_name ( indexed, start) {
1280
+ return ;
1279
1281
} else {
1280
1282
format ! ( ".skip({})" , snippet( cx, start. span, ".." ) )
1281
1283
} ;
@@ -1302,6 +1304,8 @@ fn check_for_loop_range<'tcx>(
1302
1304
1303
1305
if is_len_call ( end, indexed) || is_end_eq_array_len ( cx, end, limits, indexed_ty) {
1304
1306
String :: new ( )
1307
+ } else if visitor. indexed_mut . contains ( & indexed) && contains_name ( indexed, take_expr) {
1308
+ return ;
1305
1309
} else {
1306
1310
match limits {
1307
1311
ast:: RangeLimits :: Closed => {
0 commit comments