2 // aux-build:macro_rules.rs
3 #![warn(clippy::toplevel_ref_arg)]
4 #![allow(clippy::uninlined_format_args)]
7 extern crate macro_rules;
9 macro_rules! gen_binding {
16 // Closures should not warn
17 let y = |ref x| println!("{:?}", x);
22 let _y: &(&_, u8) = &(&1, 2);
26 let _z = &mut (1 + 2);
28 let (ref x, _) = (1, 2); // ok, not top level
29 println!("The answer is {}.", x);
31 let _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