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.
1 parent 630be51 commit 10d205bCopy full SHA for 10d205b
tests/ui/needless_deref.rs
@@ -10,7 +10,8 @@ mod should_lint {
10
}
11
12
13
-mod should_not_lint {
+// this mod explains why we should not lint `&mut &* (&T)`
14
+mod should_not_lint1 {
15
fn foo(x: &mut &u32) {
16
*x = &1;
17
@@ -24,3 +25,14 @@ mod should_not_lint {
24
25
assert_eq!(*x, 1);
26
27
28
+
29
+// this mod explains why we should not lint `& &* (&T)`
30
+mod should_not_lint2 {
31
+ fn foo() {
32
+ let x = &12;
33
+ let addr_x = &x as *const _ as usize;
34
+ let addr_y = &&*x as *const _ as usize; // assert ok
35
+ // let addr_y = &x as *const _ as usize; // assert fail
36
+ assert_ne!(addr_x, addr_y);
37
+ }
38
+}
0 commit comments