deny unsafe_op_in_unsafe_fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
cff598eb29
commit
4032c6699f
@ -28,7 +28,7 @@ impl AsRawFd for EventedFd {
|
|||||||
impl FromRawFd for EventedFd {
|
impl FromRawFd for EventedFd {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_raw_fd(fd: RawFd) -> Self {
|
unsafe fn from_raw_fd(fd: RawFd) -> Self {
|
||||||
Self::new(Fd::from_raw_fd(fd))
|
Self::new(unsafe { Fd::from_raw_fd(fd) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,17 +69,15 @@ pub struct ProxyMessageBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn io_vec_mut<T>(value: &mut T) -> IoVecMut {
|
unsafe fn io_vec_mut<T>(value: &mut T) -> IoVecMut {
|
||||||
IoVecMut::new(std::slice::from_raw_parts_mut(
|
IoVecMut::new(unsafe {
|
||||||
value as *mut T as *mut u8,
|
std::slice::from_raw_parts_mut(value as *mut T as *mut u8, mem::size_of::<T>())
|
||||||
mem::size_of::<T>(),
|
})
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn io_vec<T>(value: &T) -> IoVec {
|
unsafe fn io_vec<T>(value: &T) -> IoVec {
|
||||||
IoVec::new(std::slice::from_raw_parts(
|
IoVec::new(unsafe {
|
||||||
value as *const T as *const u8,
|
std::slice::from_raw_parts(value as *const T as *const u8, mem::size_of::<T>())
|
||||||
mem::size_of::<T>(),
|
})
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io as StdIo;
|
use std::io as StdIo;
|
||||||
|
@ -54,8 +54,10 @@ pub mod vec {
|
|||||||
/// This is generally safe to call, but the contents of the vector are undefined.
|
/// This is generally safe to call, but the contents of the vector are undefined.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
||||||
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
|
unsafe {
|
||||||
Vec::from_raw_parts(data as *mut u8, len, len)
|
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
|
||||||
|
Vec::from_raw_parts(data as *mut u8, len, len)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user