Skip to content

Commit 490f49f

Browse files
committed
Remove unnecessary stat64 pointer casts
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.
1 parent 8acec1f commit 490f49f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/sys/unix/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
787787
let p = cstr(p)?;
788788
let mut stat: stat64 = unsafe { mem::zeroed() };
789789
cvt(unsafe {
790-
stat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
790+
stat64(p.as_ptr(), &mut stat)
791791
})?;
792792
Ok(FileAttr { stat: stat })
793793
}
@@ -796,7 +796,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
796796
let p = cstr(p)?;
797797
let mut stat: stat64 = unsafe { mem::zeroed() };
798798
cvt(unsafe {
799-
lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
799+
lstat64(p.as_ptr(), &mut stat)
800800
})?;
801801
Ok(FileAttr { stat: stat })
802802
}

0 commit comments

Comments
 (0)