Skip to content

Commit 41cbe01

Browse files
committed
refactor: allow needless_range_loop
1 parent 32bc92b commit 41cbe01

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

os/src/memory/memory_set/handler.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ impl MemoryHandler for Linear {
4949
let src = core::slice::from_raw_parts(src as *const u8, PAGE_SIZE);
5050
dst[..length].clone_from_slice(&src[..length]);
5151
}
52-
for item in dst.iter_mut().take(PAGE_SIZE).skip(length) {
53-
*item = 0;
52+
#[allow(clippy::needless_range_loop)]
53+
for i in length..PAGE_SIZE {
54+
dst[i] = 0;
5455
}
5556
}
5657
}
@@ -85,8 +86,9 @@ impl MemoryHandler for ByFrame {
8586
let src = core::slice::from_raw_parts(src as *const u8, PAGE_SIZE);
8687
dst[..length].clone_from_slice(&src[..length]);
8788
}
88-
for item in dst.iter_mut().take(PAGE_SIZE).skip(length) {
89-
*item = 0;
89+
#[allow(clippy::needless_range_loop)]
90+
for i in length..PAGE_SIZE {
91+
dst[i] = 0;
9092
}
9193
}
9294
}

0 commit comments

Comments
 (0)