shared-memory: specify generic types for transmute

this annotates a `transmute` call with proper types to avoid possible
undefined behaviour, as suggested by clippy [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
This commit is contained in:
Shannon Sterz 2025-03-06 13:43:41 +01:00 committed by Wolfgang Bumiller
parent ab2d5c9777
commit dcc6eb9918

View File

@ -75,7 +75,7 @@ fn mmap_file<T: Init>(file: &mut File, initialize: bool) -> Result<Mmap<T>, Erro
Err(err) => bail!("detected wrong types in mmaped files: {}", err),
}
Ok(unsafe { std::mem::transmute(mmap) })
Ok(unsafe { std::mem::transmute::<Mmap<MaybeUninit<T>>, Mmap<T>>(mmap) })
}
impl<T: Sized + Init> SharedMemory<T> {