Skip to content

Commit

Permalink
Merge pull request #184 from Tpt/clippy-cast
Browse files Browse the repository at this point in the history
Applies a Clippy suggestion to avoid a mem::transmute call
  • Loading branch information
arkpar authored Feb 7, 2023
2 parents 753b693 + 34fed32 commit df89db8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ impl IndexTable {

fn chunk_at(index: u64, map: &memmap2::MmapMut) -> Result<&[u8; CHUNK_LEN]> {
let offset = META_SIZE + index as usize * CHUNK_LEN;
let ptr: &[u8; CHUNK_LEN] =
unsafe { std::mem::transmute(map[offset..offset + CHUNK_LEN].as_ptr()) };
let ptr = unsafe { &*(map[offset..offset + CHUNK_LEN].as_ptr() as *const [u8; CHUNK_LEN]) };
Ok(try_io!(Ok(ptr)))
}

Expand Down

0 comments on commit df89db8

Please sign in to comment.