Skip to content

Commit

Permalink
refactor(test_suite): ignore the clippy::needless_range_loop lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Mar 21, 2023
1 parent 0408109 commit 034d773
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/r3_test_suite/src/kernel_benchmarks/timer_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ impl<System: SupportedSystem> AppInner<System> {

// `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
// `core::array::from_fn` is not `const fn` [ref:const_array_from_fn]
// FIXME: `needless_range_loop` false positive
// <https://github.com/rust-lang/rust-clippy/issues/10524>
#[expect(clippy::needless_range_loop)]
for i in 0..timers.len() {
timers[i] = MaybeUninit::new(StaticTimer::define().start(|| {}).finish(b));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ impl<System: SupportedSystem> App<System> {

// `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
// `core::array::from_fn` is not `const fn` [ref:const_array_from_fn]
// FIXME: `needless_range_loop` false positive
// <https://github.com/rust-lang/rust-clippy/issues/10524>
#[expect(clippy::needless_range_loop)]
for i in 0..NUM_TASKS {
tasks[i] = Some(
StaticTask::define()
Expand Down
3 changes: 3 additions & 0 deletions src/r3_test_suite/src/kernel_tests/compute_round_robin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ impl<System: SupportedSystem> App<System> {

// `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
// `core::array::from_fn` is not `const fn` [ref:const_array_from_fn]
// FIXME: `needless_range_loop` false positive
// <https://github.com/rust-lang/rust-clippy/issues/10524>
#[expect(clippy::needless_range_loop)]
for i in 0..NUM_TASKS {
let task_state = if i == 0 {
// Reuse the storage
Expand Down
1 change: 1 addition & 0 deletions src/r3_test_suite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(assert_matches)]
#![feature(array_windows)]
#![feature(const_option)]
#![feature(lint_reasons)]
#![feature(cell_update)]
#![feature(const_iter)]
#![feature(decl_macro)]
Expand Down
4 changes: 4 additions & 0 deletions src/r3_test_suite/src/utils/trig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ pub const fn sincos(theta: f64) -> (f64, f64) {
let mut x = 1.0;
let mut y = 0.0;

// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
// FIXME: `needless_range_loop` false positive
// <https://github.com/rust-lang/rust-clippy/issues/10524>
#[expect(clippy::needless_range_loop)]
for i in 0..32 {
if (theta_i & (1u32 << i)) != 0 {
let (x2, y2) = (x, y);
Expand Down

0 comments on commit 034d773

Please sign in to comment.