Skip to content

Commit e649986

Browse files
committed
refactor(core): ignore the clippy::needless_range_loop lint
1 parent 216edbb commit e649986

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

src/r3_core/src/bind.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,9 @@ where
17781778

17791779
fn register_dependency(&self, ctx: &mut CfgBindCtx<'_>) {
17801780
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
1781+
// FIXME: `needless_range_loop` false positive
1782+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
1783+
#[expect(clippy::needless_range_loop)]
17811784
for i in 0..LEN {
17821785
self[i].register_dependency(ctx);
17831786
}
@@ -1789,6 +1792,9 @@ where
17891792
let mut out = MaybeUninit::uninit_array();
17901793
let this = MaybeUninit::new(self);
17911794
// `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
1795+
// FIXME: `needless_range_loop` false positive
1796+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
1797+
#[expect(clippy::needless_range_loop)]
17921798
for i in 0..LEN {
17931799
out[i] = MaybeUninit::new(
17941800
this.as_ptr()

src/r3_core/src/bind/sorter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ pub(super) const fn sort_bindings<Callback, SorterUseInfoList, VertexList>(
167167
let mut num_indefinite_exclusive = 0;
168168

169169
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
170+
// FIXME: `needless_range_loop` false positive
171+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
172+
#[expect(clippy::needless_range_loop)]
170173
for i in 0..bind_users.len() {
171174
// Reject impossible combinations that should be caught earlier
172175
match bind_users[i] {

src/r3_core/src/kernel/interrupt.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ pub(super) const fn panic_if_unmanaged_safety_is_violated<System: raw::KernelInt
443443
let is_line_assumed_managed = 'a: {
444444
let lines = System::RAW_MANAGED_INTERRUPT_LINES;
445445
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
446+
// FIXME: `needless_range_loop` false positive
447+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
448+
#[expect(clippy::needless_range_loop)]
446449
for i in 0..lines.len() {
447450
if lines[i] == handler.line {
448451
break 'a true;
@@ -696,6 +699,9 @@ pub const unsafe fn new_interrupt_handler_table<
696699
pub const fn num_required_interrupt_line_slots(handlers: &[CfgInterruptHandler]) -> usize {
697700
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
698701
let mut out = 0;
702+
// FIXME: `needless_range_loop` false positive
703+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
704+
#[expect(clippy::needless_range_loop)]
699705
for i in 0..handlers.len() {
700706
if handlers[i].line + 1 > out {
701707
out = handlers[i].line + 1;

src/r3_core/src/kernel/raw.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ impl QueueOrder {
270270

271271
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
272272
let values = System::RAW_SUPPORTED_QUEUE_ORDERS;
273+
// FIXME: `needless_range_loop` false positive
274+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
275+
#[expect(clippy::needless_range_loop)]
273276
for i in 0..values.len() {
274277
// `#[derive(PartialEq)]` doesn't derive `const PartialEq`
275278
// [ref:derive_const_partial_eq]
@@ -537,6 +540,9 @@ impl MutexProtocol {
537540

538541
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
539542
let values = System::RAW_SUPPORTED_MUTEX_PROTOCOLS;
543+
// FIXME: `needless_range_loop` false positive
544+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
545+
#[expect(clippy::needless_range_loop)]
540546
for i in 0..values.len() {
541547
// `#[derive(PartialEq)]` doesn't derive `const PartialEq`
542548
// [ref:derive_const_partial_eq]

src/r3_core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#![feature(set_ptr_value)] // `<*const T>::set_ptr_value`
4040
#![feature(slice_ptr_len)]
4141
#![feature(const_option)]
42+
#![feature(lint_reasons)]
4243
#![feature(cell_update)]
4344
#![feature(const_deref)]
4445
#![feature(const_heap)]

src/r3_core/src/utils/init.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ impl<T: Init, const LEN: usize> Init for [T; LEN] {
3939
let mut array = mem::MaybeUninit::uninit_array();
4040

4141
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
42+
// FIXME: `needless_range_loop` false positive
43+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
44+
#[expect(clippy::needless_range_loop)]
4245
for i in 0..LEN {
4346
array[i] = mem::MaybeUninit::new(T::INIT);
4447
}

0 commit comments

Comments
 (0)