Skip to content

Commit 13bf894

Browse files
committed
Use p.cast::<T>() instead of as *const T.
1 parent bdf0d71 commit 13bf894

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/netbsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static GETRANDOM: LazyPtr = LazyPtr::new();
2929

3030
fn dlsym_getrandom() -> *mut c_void {
3131
static NAME: &[u8] = b"getrandom\0";
32-
let name_ptr = NAME.as_ptr() as *const libc::c_char;
32+
let name_ptr = NAME.as_ptr().cast::<libc::c_char>();
3333
unsafe { libc::dlsym(libc::RTLD_DEFAULT, name_ptr) }
3434
}
3535

src/util_libc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ pub fn sys_fill_exact(
7474
pub unsafe fn open_readonly(path: &str) -> Result<libc::c_int, Error> {
7575
debug_assert_eq!(path.as_bytes().last(), Some(&0));
7676
loop {
77-
let fd = libc::open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
77+
let fd = libc::open(
78+
path.as_ptr().cast::<libc::c_char>(),
79+
libc::O_RDONLY | libc::O_CLOEXEC,
80+
);
7881
if fd >= 0 {
7982
return Ok(fd);
8083
}

0 commit comments

Comments
 (0)