diff --git a/tests/ui/needless_pass_by_ref_mut.rs b/tests/ui/needless_pass_by_ref_mut.rs index 93f94b384..7f642e53d 100644 --- a/tests/ui/needless_pass_by_ref_mut.rs +++ b/tests/ui/needless_pass_by_ref_mut.rs @@ -276,6 +276,18 @@ async fn _f(v: &mut Vec<()>) { _ = || || x; } +struct Data { + value: T, +} +// Unsafe functions should not warn. +unsafe fn get_mut_unchecked(ptr: &mut NonNull>) -> &mut T { + &mut (*ptr.as_ptr()).value +} +// Unsafe blocks should not warn. +fn get_mut_unchecked2(ptr: &mut NonNull>) -> &mut T { + unsafe { &mut (*ptr.as_ptr()).value } +} + fn main() { let mut u = 0; let mut v = vec![0];