Skip to content

Fix needless_range_loop suggests wrongly for nested index - #16634

Merged
ada4a merged 1 commit into
rust-lang:masterfrom
profetia:issue16631
Aug 8, 2026
Merged

ada4a merged 1 commit into
rust-lang:masterfrom
profetia:issue16631

Conversation

@profetia

@profetia profetia commented Feb 25, 2026 •

Copy link
Copy Markdown
Member

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 the suggestion 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

rustbot commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

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

github-actions Bot commented Feb 25, 2026 •

Copy link
Copy Markdown

Lintcheck changes for e5af49b

Lint Added Removed Changed
clippy::needless_range_loop 5 0 5

This comment will be updated if you push new changes

@profetia

Copy link
Copy Markdown
Member Author

r? clippy

@rustbot rustbot assigned ada4a and unassigned Jarcho Mar 14, 2026
@profetia

Copy link
Copy Markdown
Member Author

r? clippy

@rustbot rustbot assigned Centri3 and unassigned ada4a Mar 31, 2026
@profetia

Copy link
Copy Markdown
Member Author

r? clippy

@rustbot rustbot assigned llogiq and unassigned Centri3 Apr 12, 2026
@profetia

profetia commented May 5, 2026

Copy link
Copy Markdown
Member Author

r? clippy

@profetia

Copy link
Copy Markdown
Member Author

r? clippy

@rustbot rustbot assigned dswij and unassigned flip1995 Jun 11, 2026
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@blyxyas

blyxyas commented Jun 14, 2026

Copy link
Copy Markdown
Member

Hello @profetia, I hope that you don't mind we using this contribution to teach @medzernik some things about reviewing (they were very interested!).

cc @medzernik Check out this comment first.

@profetia

Copy link
Copy Markdown
Member Author

@blyxyas Sure! I'm also interested to learn about reviewing, feel free to use this one!

@blyxyas

blyxyas commented Jun 15, 2026

Copy link
Copy Markdown
Member

@profetia Great! In that case, we'll wait until @medzernik gets to this one. AFAIK he's already catched something interesting in another pull request.

If you're also interested in reviewing, read the comment I linked earlier. If many more people are interested in this, I might do something official with it.

@medzernik medzernik left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a simple example with a 1D array and got the following:

 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:16:14
... 287 lines skipped ...
    |

+error: the loop variable `i` is only used to index `testing_vec`
+  --> tests/ui/needless_range_loop.rs:254:14
+   |
+LL |     for i in 0..3 {
+   |              ^^^^
+   |
+note: for this index operation
+  --> tests/ui/needless_range_loop.rs:255:9
+   |
+LL |         testing_vec[i] = 0;
+   |         ^^^^^^^^^^^^^^
+help: consider using an iterator
+   |
+LL -     for i in 0..3 {
+LL +     for <item> in testing_vec.iter_mut().take(3) {

I was wondering, wouldn't it make more sense to suggest just .iter()/iter_mut() (without the take(x == testing_vec.len()) if the length of the array matches the length of the range?

Other than that, I guess the PR is good? xD I'll leave the comment as requesting changes so the bot throws the ball, but if it's not a valid one/fit for a different review, just let me know and I'll approve the PR :D

View changes since this review

@rustbot

This comment has been minimized.

@ada4a

ada4a commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

@profetia I won't say much here as I'm not the reviewer, but:

While code clean-ups like:

  • changing the way the contents of visitor.indexed_directly are extracted
  • switching to using one span_lint_and_then call instead of two

are very welcome, having them in the same commit as functional changes makes reviewing unnecessarily difficult. Please consider extracting them into a separate commit whenever possible -- that would hopefully help the maintainers review your numerous (and very welcome!) patches faster.

@medzernik I think that improvement would be best to leave for another PR, as this one already does a lot of things. So I'd say let's merge this PR if it looks good to you:)

kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 16, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 16, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
mj22226 pushed a commit to mj22226/linux that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
mj22226 pushed a commit to mj22226/linux that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
mj22226 pushed a commit to mj22226/linux that referenced this pull request Sep 17, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 18, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 18, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 18, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 18, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 19, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 19, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 20, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 20, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 20, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernelorg-mirror-bot Bot pushed a commit to kernelorg-mirror/linux_kernel_git_stable_linux-stable-rc that referenced this pull request Sep 20, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit to kernel-patches/linux-stable that referenced this pull request Sep 20, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 21, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this pull request Sep 21, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
woodsts pushed a commit to woodsts/linux-stable that referenced this pull request Sep 21, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
woodsts pushed a commit to woodsts/linux-stable that referenced this pull request Sep 21, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
opsiff pushed a commit to deepin-community/kernel that referenced this pull request Sep 22, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit fec4470173562d3eb96825d9e27bf7aae73b56f9)
Signed-off-by: Wentao Guan <[email protected]>
pkitszel pushed a commit to pkitszel/linux that referenced this pull request Sep 25, 2026
Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
pkitszel pushed a commit to pkitszel/linux that referenced this pull request Sep 28, 2026
Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
codefaber pushed a commit to codefaber/hallon-kernel that referenced this pull request Oct 1, 2026
commit 97f8cb91a8c5658fe2ae6f5c2ff6e95474a5eb2f upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
oraclelinuxkernel pushed a commit to oracle/linux-uek that referenced this pull request Oct 9, 2026
commit 97f8cb9 upstream.

Starting with Rust 1.100.0 (expected 2026-11-12), Clippy warns:

    warning: the loop variable `i` is only used to index `self.decimals`
       --> drivers/gpu/drm/drm_panic_qr.rs:410:18
        |
    410 |         for i in 0..len {
        |                  ^^^^^^
        |
    note: for this index operation
       --> drivers/gpu/drm/drm_panic_qr.rs:411:13
        |
    411 |             self.decimals[i] = (chunk % 10) as u8;
        |             ^^^^^^^^^^^^^^^^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
        = note: `-W clippy::needless-range-loop` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_range_loop)]`
    help: consider using an iterator
        |
    410 -         for i in 0..len {
    410 +         for <item> in self.decimals.iter_mut().take(len) {
        |

The lint did not trigger here before because it could not handle arrays
behind a field access such as `self.decimals` -- Clippy was improved to
catch those cases [1][2].

Thus clean the warning by iterating over a slice rather than using
`take()` so that an out-of-range `len` still triggers the same bounds
check as the indexed loop.

Cc: [email protected] # Needed in 6.18.y and later.
Link: rust-lang/rust-clippy#16631 [1]
Link: rust-lang/rust-clippy#16634 [2]
Assisted-by: LLM
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
… 1.100.0 (dfinity#12142)

`cargo clippy` fixes to prepare for upgrading to
[rustc-1.100.0](https://blog.rust-lang.org/2026/11/12/Rust-1.100.0/).

Clippy 0.1.100 reports **10 sites** that 0.1.99 does not, in 9 files.
All of them are in hand-written
code. Nine are fixed in the code and one gets a local `#[allow]` (see
below), so no new global
`--allow` is needed:

| lint | sites | why it fires now | fix |
| --- | --: | --- | --- |
|
[`needless_range_loop`](https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#needless_range_loop)
| 4 | [#16634](rust-lang/rust-clippy#16634),
which is missing from the changelog, makes the lint look through field
accesses. So `self.coefficients[i]` and `public_key_bytes.0[i]` are now
linted like `v[i]` | iterate over the elements instead of the indices,
with `.enumerate()` where the index is used too. The two test loops that
zero a public key become `.fill(0)` |
|
[`needless_bool`](https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#needless_bool)
| 3 | [#17185](rust-lang/rust-clippy#17185): now
also lints the early-return guard form `if !c { return false; } true` |
return the condition, except in SNS governance's `list_proposals` (see
below) |
|
[`unnecessary_fold`](https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#unnecessary_fold)
| 2 | [#17445](rust-lang/rust-clippy#17445): now
lints `fold` over an `Option`'s iterator |
`archive_guard.as_ref().map_or(0, \|archive\| archive.nodes().len())` in
the ICP and ICRC-1 ledgers' `encode_metrics` |
|
[`duplicated_attributes`](https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#duplicated_attributes)
| 1 | [#17396](rust-lang/rust-clippy#17396)
moved the check from items to every attribute list, so struct fields are
now checked too | `ic-admin`'s `chain_key_configs_to_generate` had
`#[clap(long)]` both above and below its doc comment. Now it has one,
below the doc comment (see below) |

Each fix keeps the behaviour. One deserves a word: `query_stats`'
`duplicate_id_test` still needs
its index for the match guard, the expected canister ID and the panic
messages. So it now iterates
`test_stats.stats.iter().enumerate().take(3)`, which runs the same three
iterations as `0..3` over
its four stats. Its doc comment also describes a fourth case (canister
4) that the loop has never
covered. This PR leaves that as it is.

Two changes come from review:

* **SNS governance's `list_proposals`** keeps the early-return form of
its last proposal filter.
Every filter in its `filter_all` closure rejects a proposal with an
early `return false`, and
returning only the last one's condition would break that pattern. So the
closure gets
`#[allow(clippy::needless_bool)]` instead. The lint exists in Clippy
0.1.99 too, so the allow is
  valid on both toolchains.
* **`update_subnet.rs`** now has every `#[clap(long)]` right above its
field, below the doc comment.
Before, 12 of the 20 fields with a plain `#[clap(long)]` had it above
the doc comment
  (`chain_key_configs_to_generate` on both sides). The help output of
`ic-admin propose-to-update-subnet` (`-h` and `--help`) is byte-for-byte
unchanged. Other
  `ic-admin` files keep their mixed order.

The two global allows that dfinity#11734 added stay for now:

* **`double_must_use`**: Clippy 0.1.100 ships the fix
([#17547](rust-lang/rust-clippy#17547)) and
reports nothing without the
allow. But 0.1.99 still needs it, so the PR stacked on this one removes
it.
* **`redundant_field_names`**: 0.1.100 still flags the same 41 sites in
thiserror and derive-new
output. The fix,
[rust-lang/rust#164816](rust-lang/rust#164816),
ships in
  1.101.

Because this PR lands *before* the toolchain bump, it has to stay clean
on 1.99.1 too. It uses no
API that 1.99.1 lacks.

The toolchain upgrade itself is the PR stacked on top of this one
(dfinity#12143).

## Testing

* `./ci/scripts/rust-lint.sh` exits 0 both on the currently pinned
**1.99.1** and on **1.100.0**.
* On 1.99.1, these pass:
  * `cargo check --all-targets --all-features` of the 9 touched crates
  * `bazel build` of the 32 directly affected targets
* Of the 284 tests that depend on the touched files within two hops, 262
passed locally before the
run was stopped in favour of CI (`CI_ALL_BAZEL_TARGETS`). The other 22:
  * 3 failures are environmental: the golden-state tests
(`icrc_ledger_suite_integration_golden_state_upgrade_downgrade_test`,
its `_u256` variant and
`golden_state_swap_upgrade_twice`) cannot fetch their state over SSH
from the dev environment.
* 19 had not run yet: subnet-recovery and subnet-cooling-down system
tests, which depend on
`ic-admin`. This PR's changes to `ic-admin` leave its
`propose-to-update-subnet` help output as
    it was.
* For the review changes, on 1.99.1: `cargo check --all-targets
--all-features` of
`ic-sns-governance` and `ic-admin`, and `bazel build` of their 6
directly affected targets pass.
Of the 114 tests within two hops of these two files, 94 had finished
when the local run was
stopped in favour of CI: 93 passed, and
`golden_state_swap_upgrade_twice` failed because it can't
  fetch its golden state over SSH from the dev environment.
* CI with `CI_ALL_BAZEL_TARGETS` passed on 4720dcc. The review
changes get the default diff-based
  CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

10 participants