[pbs-devel] [PATCH proxmox 3/6] io: remove unnecesary cast to *mut u8

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Feb 28 12:39:17 CET 2024


Fixes the clippy lint:

   warning: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
     --> proxmox-io/src/vec/mod.rs:57:29
      |
   57 |         Vec::from_raw_parts(data as *mut u8, len, len)
      |                             ^^^^^^^^^^^^^^^ help: try: `data`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
      = note: `#[warn(clippy::unnecessary_cast)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-io/src/vec/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-io/src/vec/mod.rs b/proxmox-io/src/vec/mod.rs
index 8798025d..16d3a32e 100644
--- a/proxmox-io/src/vec/mod.rs
+++ b/proxmox-io/src/vec/mod.rs
@@ -54,7 +54,7 @@ pub use byte_vec::ByteVecExt;
 pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
     unsafe {
         let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
-        Vec::from_raw_parts(data as *mut u8, len, len)
+        Vec::from_raw_parts(data, len, len)
     }
 }
 
-- 
2.39.2





More information about the pbs-devel mailing list