clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
8261331958
commit
cff598eb29
@ -14,11 +14,10 @@ pub const fn capacity<T: Sized>() -> usize {
|
|||||||
|
|
||||||
pub fn buffer<T: Sized>() -> Vec<u8> {
|
pub fn buffer<T: Sized>() -> Vec<u8> {
|
||||||
let capacity = capacity::<T>();
|
let capacity = capacity::<T>();
|
||||||
let mut buf = Vec::with_capacity(capacity);
|
|
||||||
unsafe {
|
unsafe {
|
||||||
buf.set_len(capacity);
|
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(capacity).unwrap());
|
||||||
|
Vec::from_raw_parts(data as *mut u8, capacity, capacity)
|
||||||
}
|
}
|
||||||
buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RawCmsgIterator<'a> {
|
pub struct RawCmsgIterator<'a> {
|
||||||
|
@ -54,9 +54,8 @@ 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 mut out = Vec::with_capacity(len);
|
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
|
||||||
out.set_len(len);
|
Vec::from_raw_parts(data as *mut u8, len, len)
|
||||||
out
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user