clippy: fix ptr_as_ptr lint

This commit is contained in:
xtqqczze
2026-03-19 22:05:47 +01:00
committed by Sylvestre Ledru
parent 1535cfdd9b
commit 5f85e267db
2 changed files with 2 additions and 4 deletions
-1
View File
@@ -146,7 +146,6 @@ cast_sign_loss = "allow" # 4
cast_possible_wrap = "allow" # 4
uninlined_format_args = "allow" # 3
similar_names = "allow" # 3
ptr_as_ptr = "allow" # 3
used_underscore_binding = "allow" # 2
too_many_lines = "allow" # 2
struct_excessive_bools = "allow" # 2
+2 -3
View File
@@ -815,8 +815,7 @@ fn reliable_write(fd: i32, ptr: *const u8, len: usize) -> std::io::Result<usize>
impl Write for FdWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let ret =
unsafe { libc::write(self.0, buf.as_ptr() as *const libc::c_void, buf.len()) };
let ret = unsafe { libc::write(self.0, buf.as_ptr().cast(), buf.len()) };
if ret < 0 {
Err(io::Error::last_os_error())
} else {
@@ -1694,7 +1693,7 @@ mod tests {
thread::spawn(move || {
let mut buf = [0u8; 1024];
loop {
let n = unsafe { libc::read(read_fd, buf.as_mut_ptr() as *mut _, buf.len()) };
let n = unsafe { libc::read(read_fd, buf.as_mut_ptr().cast(), buf.len()) };
if n <= 0 {
break;
}