Skip to content

Fix needless_range_loop suggests wrongly for nested index#16634

Open
profetia wants to merge 1 commit intorust-lang:masterfrom
profetia:issue16631
Open

Fix needless_range_loop suggests wrongly for nested index#16634
profetia wants to merge 1 commit intorust-lang:masterfrom
profetia:issue16631

Conversation

@profetia
Copy link
Member

@profetia profetia commented Feb 25, 2026

Closes #11529
Closes #16631
Closes #15560
Closes #16344

This PR addresses two problems of needless_range_loop:

  1. It suggests wrongly when the index is after other indexes or field accesses.
  2. When the index is nested, it does not specify which index to replace, making it confusing.

changelog: [needless_range_loop] fix wrong suggestions for nested index

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 25, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2026

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@github-actions
Copy link

Lintcheck changes for 8fcade6

Lint Added Removed Changed
clippy::needless_range_loop 5 0 5

This comment will be updated if you push new changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

3 participants