Clippy: use ptr::add rather than ptr::offset.

This commit is contained in:
Dan Gohman
2019-08-13 19:17:27 -07:00
committed by Jakub Konka
parent 34db7f0150
commit 09ace35295

View File

@@ -251,15 +251,15 @@ pub(crate) fn fd_readdir(
break; break;
} }
unsafe { unsafe {
let ptr = host_buf_ptr.offset(host_buf_offset as isize) as *mut c_void let ptr =
as *mut host::__wasi_dirent_t; host_buf_ptr.add(host_buf_offset) as *mut c_void as *mut host::__wasi_dirent_t;
*ptr = entry; *ptr = entry;
} }
host_buf_offset += std::mem::size_of_val(&entry); host_buf_offset += std::mem::size_of_val(&entry);
let name_ptr = unsafe { *host_entry }.d_name.as_ptr(); let name_ptr = unsafe { *host_entry }.d_name.as_ptr();
unsafe { unsafe {
memcpy( memcpy(
host_buf_ptr.offset(host_buf_offset as isize) as *mut _, host_buf_ptr.add(host_buf_offset) as *mut _,
name_ptr as *const _, name_ptr as *const _,
name_len, name_len,
) )