Skip to content

Commit

Permalink
use a more efficient method to copy [u8]
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Feb 8, 2021
1 parent aa03ab8 commit 0e2ae2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/read/endian_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ where
fn read_slice(&mut self, buf: &mut [u8]) -> Result<()> {
match self.range.read_slice(buf.len()) {
Some(slice) => {
buf.clone_from_slice(slice);
buf.copy_from_slice(slice);
Ok(())
}
None => Err(Error::UnexpectedEof(self.offset_id())),
Expand Down
2 changes: 1 addition & 1 deletion src/read/endian_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ where
#[inline]
fn read_slice(&mut self, buf: &mut [u8]) -> Result<()> {
let slice = self.read_slice(buf.len())?;
buf.clone_from_slice(slice);
buf.copy_from_slice(slice);
Ok(())
}
}
Expand Down

0 comments on commit 0e2ae2b

Please sign in to comment.