Skip to content

Commit 95845ec

Browse files
authored
style(lib): fix ptr_as_ptr lint (#4091)
1 parent ac2c76d commit 95845ec

5 files changed

Lines changed: 4 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ needless_continue = "allow"
143143
needless_pass_by_value = "allow"
144144
panic = "allow"
145145
pattern_type_mismatch = "allow"
146-
ptr_as_ptr = "allow"
147146
question_mark = "allow" # TODO: probably easy fix
148147
redundant_closure_for_method_calls = "allow"
149148
redundant_else = "allow"

src/ffi/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl Read for hyper_io {
147147
cx: &mut Context<'_>,
148148
mut buf: crate::rt::ReadBufCursor<'_>,
149149
) -> Poll<std::io::Result<()>> {
150-
let buf_ptr = unsafe { buf.as_mut() }.as_mut_ptr() as *mut u8;
150+
let buf_ptr = unsafe { buf.as_mut() }.as_mut_ptr().cast::<u8>();
151151
let buf_len = buf.remaining();
152152

153153
match (self.read)(self.userdata, hyper_context::wrap(cx), buf_ptr, buf_len) {

src/ffi/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ ffi_fn! {
415415
let task = non_null!(&mut *task ?= ptr::null_mut());
416416

417417
if let Some(val) = task.output.take() {
418-
let p = Box::into_raw(val) as *mut c_void;
418+
let p = Box::into_raw(val).cast();
419419
// protect from returning fake pointers to empty types
420420
if p == std::ptr::NonNull::<c_void>::dangling().as_ptr() {
421421
ptr::null_mut()

src/rt/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl dyn Sleep {
119119
unsafe {
120120
let inner = Pin::into_inner_unchecked(self);
121121
Some(Pin::new_unchecked(
122-
&mut *(&mut *inner as *mut dyn Sleep as *mut T),
122+
&mut *(&mut *inner as *mut dyn Sleep).cast(),
123123
))
124124
}
125125
} else {

src/upgrade.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl dyn Io + Send {
307307
// Taken from `std::error::Error::downcast()`.
308308
unsafe {
309309
let raw: *mut dyn Io = Box::into_raw(self);
310-
Ok(Box::from_raw(raw as *mut T))
310+
Ok(Box::from_raw(raw.cast()))
311311
}
312312
} else {
313313
Err(self)

0 commit comments

Comments
 (0)