]> git.lizzy.rs Git - rust.git/blob - tests/ui/deref_addrof_double_trigger.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / deref_addrof_double_trigger.rs
1 // This test can't work with run-rustfix because it needs two passes of test+fix
2
3 #[warn(clippy::deref_addrof)]
4 #[allow(unused_variables, unused_mut)]
5 fn main() {
6     let a = 10;
7
8     //This produces a suggestion of 'let b = *&a;' which
9     //will trigger the 'clippy::deref_addrof' lint again
10     let b = **&&a;
11
12     {
13         let mut x = 10;
14         let y = *&mut x;
15     }
16
17     {
18         //This produces a suggestion of 'let y = *&mut x' which
19         //will trigger the 'clippy::deref_addrof' lint again
20         let mut x = 10;
21         let y = **&mut &mut x;
22     }
23 }