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> {
|
||||
let capacity = capacity::<T>();
|
||||
let mut buf = Vec::with_capacity(capacity);
|
||||
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> {
|
||||
|
@ -54,9 +54,8 @@ pub mod vec {
|
||||
/// This is generally safe to call, but the contents of the vector are undefined.
|
||||
#[inline]
|
||||
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
||||
let mut out = Vec::with_capacity(len);
|
||||
out.set_len(len);
|
||||
out
|
||||
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