2 // aux-build:macro_rules.rs
4 #![warn(clippy::toplevel_ref_arg)]
7 extern crate macro_rules;
9 macro_rules! gen_binding {
16 // Closures should not warn
17 let y = |ref x| println!("{:?}", x);
22 let ref _y: (&_, u8) = (&1, 2);
26 let ref mut _z = 1 + 2;
28 let (ref x, _) = (1, 2); // ok, not top level
29 println!("The answer is {}.", x);
31 let ref _x = vec![1, 2, 3];
33 // Make sure that allowing the lint works
34 #[allow(clippy::toplevel_ref_arg)]
35 let ref mut _x = 1_234_543;
38 for ref _x in 0..10 {}
46 // do not lint in external macro