]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary stat64 pointer casts
authorJosh Stone <jistone@redhat.com>
Mon, 25 Jun 2018 19:34:33 +0000 (12:34 -0700)
committerJosh Stone <jistone@redhat.com>
Mon, 25 Jun 2018 19:34:33 +0000 (12:34 -0700)
In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.

src/libstd/sys/unix/fs.rs

index 774340388e1db9b7fe38a3646aec42e5c8d13813..93e2f4425b68e317f0e5e62d91edca16f30eaf0f 100644 (file)
@@ -787,7 +787,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
     let p = cstr(p)?;
     let mut stat: stat64 = unsafe { mem::zeroed() };
     cvt(unsafe {
-        stat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+        stat64(p.as_ptr(), &mut stat)
     })?;
     Ok(FileAttr { stat: stat })
 }
@@ -796,7 +796,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
     let p = cstr(p)?;
     let mut stat: stat64 = unsafe { mem::zeroed() };
     cvt(unsafe {
-        lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+        lstat64(p.as_ptr(), &mut stat)
     })?;
     Ok(FileAttr { stat: stat })
 }