]> git.proxmox.com Git - proxmox-fuse.git/commitdiff
clippy fixups
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 13 Jun 2022 12:24:26 +0000 (14:24 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 13 Jun 2022 12:24:29 +0000 (14:24 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/sys.rs

index 3cb5c339df9631e53f0bf99b7fc76418201e3688..2d054d04618cc7e19b4524ee3fef7e75ca95d905 100644 (file)
@@ -290,10 +290,10 @@ impl std::fmt::Debug for ReplyBuf {
 impl ReplyBuf {
     /// Create a new empty `ReplyBuf` of `size` with element counting index at `next`.
     pub fn new(request: Request, size: usize) -> Self {
-        let mut buffer = Vec::with_capacity(size);
-        unsafe {
-            buffer.set_len(size);
-        }
+        let buffer = unsafe {
+            let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(size).unwrap());
+            Vec::from_raw_parts(data as *mut u8, size, size)
+        };
         Self {
             buffer,
             filled: 0,