Skip to content

Commit 705842a

Browse files
authored
Merge pull request gimli-rs#549 from the8472/copy-from-slice
use a more efficient method to copy [u8]
2 parents aa03ab8 + 0e2ae2b commit 705842a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/read/endian_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ where
469469
fn read_slice(&mut self, buf: &mut [u8]) -> Result<()> {
470470
match self.range.read_slice(buf.len()) {
471471
Some(slice) => {
472-
buf.clone_from_slice(slice);
472+
buf.copy_from_slice(slice);
473473
Ok(())
474474
}
475475
None => Err(Error::UnexpectedEof(self.offset_id())),

src/read/endian_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ where
305305
#[inline]
306306
fn read_slice(&mut self, buf: &mut [u8]) -> Result<()> {
307307
let slice = self.read_slice(buf.len())?;
308-
buf.clone_from_slice(slice);
308+
buf.copy_from_slice(slice);
309309
Ok(())
310310
}
311311
}

0 commit comments

Comments
 (0)