[pbs-devel] [PATCH proxmox 07/18] acl: remove null pointer cast

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 12:45:03 CEST 2024


Fixes the clippy warning:

warning: casting raw pointers to the same type and constness is unnecessary (`*mut fs::acl::libc::c_void` -> `*mut fs::acl::libc::c_void`)
   --> proxmox-sys/src/fs/acl.rs:130:23
    |
130 |         let mut ptr = ptr::null_mut() as *mut c_void;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr::null_mut()`
    |
    = 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-sys/src/fs/acl.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-sys/src/fs/acl.rs b/proxmox-sys/src/fs/acl.rs
index 5ac01bc3..6f256008 100644
--- a/proxmox-sys/src/fs/acl.rs
+++ b/proxmox-sys/src/fs/acl.rs
@@ -127,7 +127,7 @@ impl ACL {
     }
 
     pub fn create_entry(&mut self) -> Result<ACLEntry, nix::errno::Errno> {
-        let mut ptr = ptr::null_mut() as *mut c_void;
+        let mut ptr = ptr::null_mut();
         let res = unsafe { acl_create_entry(&mut self.ptr, &mut ptr) };
         if res < 0 {
             return Err(Errno::last());
@@ -200,7 +200,7 @@ impl<'a> ACLEntry<'a> {
 
     pub fn get_permissions(&self) -> Result<u64, nix::errno::Errno> {
         let mut permissions = 0;
-        let mut permset = ptr::null_mut() as *mut c_void;
+        let mut permset = ptr::null_mut();
         let mut res = unsafe { acl_get_permset(self.ptr, &mut permset) };
         if res < 0 {
             return Err(Errno::last());
@@ -221,7 +221,7 @@ impl<'a> ACLEntry<'a> {
     }
 
     pub fn set_permissions(&mut self, permissions: u64) -> Result<u64, nix::errno::Errno> {
-        let mut permset = ptr::null_mut() as *mut c_void;
+        let mut permset = ptr::null_mut();
         let mut res = unsafe { acl_get_permset(self.ptr, &mut permset) };
         if res < 0 {
             return Err(Errno::last());
-- 
2.39.2





More information about the pbs-devel mailing list