diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/ptr_as_ptr.fixed')
| -rw-r--r-- | src/tools/clippy/tests/ui/ptr_as_ptr.fixed | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/ptr_as_ptr.fixed b/src/tools/clippy/tests/ui/ptr_as_ptr.fixed index fa15c323540..2033f31c1ee 100644 --- a/src/tools/clippy/tests/ui/ptr_as_ptr.fixed +++ b/src/tools/clippy/tests/ui/ptr_as_ptr.fixed @@ -16,6 +16,7 @@ mod issue_11278_b { pub fn f(o: &mut super::issue_11278_a::T<dyn std::fmt::Debug>) -> super::issue_11278_a::T<String> { // Retain `super` *unsafe { Box::from_raw(Box::into_raw(Box::new(o)).cast::<super::issue_11278_a::T<String>>()) } + //~^ ptr_as_ptr } } @@ -25,12 +26,15 @@ fn main() { let mut_ptr: *mut u32 = &mut 42_u32; let _ = ptr.cast::<i32>(); + //~^ ptr_as_ptr let _ = mut_ptr.cast::<i32>(); + //~^ ptr_as_ptr // Make sure the lint can handle the difference in their operator precedences. unsafe { let ptr_ptr: *const *const u32 = &ptr; let _ = (*ptr_ptr).cast::<i32>(); + //~^ ptr_as_ptr } // Changes in mutability. Do not lint this. @@ -44,10 +48,13 @@ fn main() { // Ensure the lint doesn't produce unnecessary turbofish for inferred types. let _: *const i32 = ptr.cast(); + //~^ ptr_as_ptr let _: *mut i32 = mut_ptr.cast(); + //~^ ptr_as_ptr // Make sure the lint is triggered inside a macro let _ = inline!($ptr.cast::<i32>()); + //~^ ptr_as_ptr // Do not lint inside macros from external crates let _ = external!($ptr as *const i32); @@ -69,7 +76,9 @@ fn _msrv_1_38() { let mut_ptr: *mut u32 = &mut 42_u32; let _ = ptr.cast::<i32>(); + //~^ ptr_as_ptr let _ = mut_ptr.cast::<i32>(); + //~^ ptr_as_ptr } #[allow(clippy::unnecessary_cast)] @@ -77,37 +86,45 @@ mod null { fn use_path_mut() -> *mut u32 { use std::ptr; ptr::null_mut::<u32>() + //~^ ptr_as_ptr } fn full_path_mut() -> *mut u32 { std::ptr::null_mut::<u32>() + //~^ ptr_as_ptr } fn core_path_mut() -> *mut u32 { use core::ptr; ptr::null_mut::<u32>() + //~^ ptr_as_ptr } fn full_core_path_mut() -> *mut u32 { core::ptr::null_mut::<u32>() + //~^ ptr_as_ptr } fn use_path() -> *const u32 { use std::ptr; ptr::null::<u32>() + //~^ ptr_as_ptr } fn full_path() -> *const u32 { std::ptr::null::<u32>() + //~^ ptr_as_ptr } fn core_path() -> *const u32 { use core::ptr; ptr::null::<u32>() + //~^ ptr_as_ptr } fn full_core_path() -> *const u32 { core::ptr::null::<u32>() + //~^ ptr_as_ptr } } @@ -115,37 +132,45 @@ mod null_ptr_infer { fn use_path_mut() -> *mut u32 { use std::ptr; ptr::null_mut() + //~^ ptr_as_ptr } fn full_path_mut() -> *mut u32 { std::ptr::null_mut() + //~^ ptr_as_ptr } fn core_path_mut() -> *mut u32 { use core::ptr; ptr::null_mut() + //~^ ptr_as_ptr } fn full_core_path_mut() -> *mut u32 { core::ptr::null_mut() + //~^ ptr_as_ptr } fn use_path() -> *const u32 { use std::ptr; ptr::null() + //~^ ptr_as_ptr } fn full_path() -> *const u32 { std::ptr::null() + //~^ ptr_as_ptr } fn core_path() -> *const u32 { use core::ptr; ptr::null() + //~^ ptr_as_ptr } fn full_core_path() -> *const u32 { core::ptr::null() + //~^ ptr_as_ptr } } @@ -153,36 +178,44 @@ mod null_entire_infer { fn use_path_mut() -> *mut u32 { use std::ptr; ptr::null_mut() + //~^ ptr_as_ptr } fn full_path_mut() -> *mut u32 { std::ptr::null_mut() + //~^ ptr_as_ptr } fn core_path_mut() -> *mut u32 { use core::ptr; ptr::null_mut() + //~^ ptr_as_ptr } fn full_core_path_mut() -> *mut u32 { core::ptr::null_mut() + //~^ ptr_as_ptr } fn use_path() -> *const u32 { use std::ptr; ptr::null() + //~^ ptr_as_ptr } fn full_path() -> *const u32 { std::ptr::null() + //~^ ptr_as_ptr } fn core_path() -> *const u32 { use core::ptr; ptr::null() + //~^ ptr_as_ptr } fn full_core_path() -> *const u32 { core::ptr::null() + //~^ ptr_as_ptr } } |
