2023-07-17 03:19:29 -05:00
|
|
|
#![warn(clippy::unnecessary_cast)]
|
2023-08-24 14:32:12 -05:00
|
|
|
//@no-rustfix
|
2023-07-17 03:19:29 -05:00
|
|
|
fn main() {
|
|
|
|
let _ = std::ptr::null() as *const u8;
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: casting raw pointers to the same type and constness is unnecessary (`*cons
|
|
|
|
//~| NOTE: `-D clippy::unnecessary-cast` implied by `-D warnings`
|
2023-07-17 03:19:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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)()
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: casting raw pointers to the same type and constness is unnecessary
|
2023-07-17 03:19:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|