We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
needless_pass_by_ref_mut
1 parent c40e242 commit 6e6e267Copy full SHA for 6e6e267
tests/ui/needless_pass_by_ref_mut.rs
@@ -270,6 +270,18 @@ pub async fn closure4(n: &mut usize) {
270
})();
271
}
272
273
+struct Data<T: ?Sized> {
274
+ value: T,
275
+}
276
+// Unsafe functions should not warn.
277
+unsafe fn get_mut_unchecked<T>(ptr: &mut NonNull<Data<T>>) -> &mut T {
278
+ &mut (*ptr.as_ptr()).value
279
280
+// Unsafe blocks should not warn.
281
+fn get_mut_unchecked2<T>(ptr: &mut NonNull<Data<T>>) -> &mut T {
282
+ unsafe { &mut (*ptr.as_ptr()).value }
283
284
+
285
fn main() {
286
let mut u = 0;
287
let mut v = vec![0];
0 commit comments