all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 3/6] io: remove unnecesary cast to *mut u8
Date: Wed, 28 Feb 2024 12:39:17 +0100	[thread overview]
Message-ID: <20240228113920.302844-3-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240228113920.302844-1-m.sandoval@proxmox.com>

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@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





  parent reply	other threads:[~2024-02-28 11:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 11:39 [pbs-devel] [PATCH proxmox 1/6] acme: Default `impl` can be derived Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 2/6] remove needless_borrow Maximiliano Sandoval
2024-02-28 11:39 ` Maximiliano Sandoval [this message]
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 4/6] schema: de: don't use while where we don't loop Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 5/6] rest: do not convert string to string Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 6/6] rrd: use unwrap_or_default when possible Maximiliano Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240228113920.302844-3-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal