Skip to content

Commit

Permalink
Applies a Clippy suggestion to avoid a mem::transmute calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Feb 7, 2023
1 parent 753b693 commit 34fed32
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 34fed32

Please sign in to comment.