Skip to content

Commit 26260fd

Browse files
committed
follow clippy lints: remove direct array indexing and use .get() instead
1 parent c1f2bf0 commit 26260fd

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/rtc.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,7 @@ impl<'r> RtcNvram<'r> {
178178
/// Dumps the current contents of all NVRAM storage cells into an array.
179179
/// This is primarily useful for integrity checks and is NOT intended as a replacement for accessing individual cells via `storage()` and calling `read()` on them.
180180
pub fn dump_storage(&self) -> [u32; IMXRT_GPREG_COUNT] {
181-
let mut data = [0u32; IMXRT_GPREG_COUNT];
182-
for (i, storage) in self.storage.iter().enumerate() {
183-
data[i] = storage.read();
184-
}
185-
data
181+
core::array::from_fn(|i| self.storage.get(i).map_or(0u32, |storage| storage.read()))
186182
}
187183
}
188184

0 commit comments

Comments
 (0)