]> git.lizzy.rs Git - rust.git/blob - tests/ui/toplevel_ref_arg.fixed
Auto merge of #4575 - Manishearth:suggestions, r=oli-obk
[rust.git] / tests / ui / toplevel_ref_arg.fixed
1 // run-rustfix
2
3 #![warn(clippy::toplevel_ref_arg)]
4 #![allow(unused)]
5
6 fn main() {
7     // Closures should not warn
8     let y = |ref x| println!("{:?}", x);
9     y(1u8);
10
11     let x = &1;
12
13     let y: &(&_, u8) = &(&1, 2);
14
15     let z = &(1 + 2);
16
17     let z = &mut (1 + 2);
18
19     let (ref x, _) = (1, 2); // ok, not top level
20     println!("The answer is {}.", x);
21
22     // Make sure that allowing the lint works
23     #[allow(clippy::toplevel_ref_arg)]
24     let ref mut x = 1_234_543;
25 }