summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2026-08-26 16:56:42 +0200
committerMiguel Ojeda <ojeda@kernel.org>2026-09-04 00:54:41 +0200
commit97f8cb91a8c5658fe2ae6f5c2ff6e95474a5eb2f (patch)
treed07ef9bb1220d8806251e8bd3b9c21ddc5f7178d /scripts/basic
parente510334fbaeaa016ac76d80b4c5f47611c5f7860 (diff)
downloadlinux-97f8cb91a8c5658fe2ae6f5c2ff6e95474a5eb2f.tar.gz
linux-97f8cb91a8c5658fe2ae6f5c2ff6e95474a5eb2f.zip
drm/panic: clean new `clippy::needless_range_loop` lint for Rust 1.100.0
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: stable@vger.kernel.org # Needed in 6.18.y and later. Link: https://github.com/rust-lang/rust-clippy/issues/16631 [1] Link: https://github.com/rust-lang/rust-clippy/pull/16634 [2] Assisted-by: LLM Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260826145642.43807-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions