Skip to content

Commit 83831c0

Browse files
committed
Use libcore to memset a slice.
The API exists, we might as well use it.
1 parent 2c836db commit 83831c0

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/blockdevice.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ where
140140
/// Access a blank sector
141141
pub fn blank_mut(&mut self, block_idx: BlockIdx) -> &mut Block {
142142
self.block_idx = Some(block_idx);
143-
for b in self.block[0].iter_mut() {
144-
*b = 0;
145-
}
143+
self.block[0].fill(0);
146144
&mut self.block[0]
147145
}
148146

src/sdcard/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,7 @@ where
341341
return Err(Error::ReadError);
342342
}
343343

344-
for b in buffer.iter_mut() {
345-
*b = 0xFF;
346-
}
344+
buffer.fill(0xFF);
347345
self.transfer_bytes(buffer)?;
348346

349347
// These two bytes are always sent. They are either a valid CRC, or

0 commit comments

Comments
 (0)