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