rust/tests/ui/unnecessary_cast_unfixable.rs
Alex Macleod ea36a9df75 Set unnecessary_cast suggestion to MaybeIncorrect for pointer casts
Removing casts may cause type inference to stop working which requires
manual intervention
2023-07-13 13:29:41 +00:00

23 lines
402 B
Rust

#![warn(clippy::unnecessary_cast)]
fn main() {
let _ = std::ptr::null() as *const u8;
}
mod issue11113 {
#[repr(C)]
struct Vtbl {
query: unsafe extern "system" fn(),
}
struct TearOff {
object: *mut std::ffi::c_void,
}
impl TearOff {
unsafe fn query(&self) {
((*(*(self.object as *mut *mut _) as *mut Vtbl)).query)()
}
}
}