]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/toplevel_ref_arg_non_rustfix.rs
Auto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / tests / ui / toplevel_ref_arg_non_rustfix.rs
1 // aux-build:macro_rules.rs
2
3 #![warn(clippy::toplevel_ref_arg)]
4 #![allow(unused)]
5
6 #[macro_use]
7 extern crate macro_rules;
8
9 fn the_answer(ref mut x: u8) {
10     *x = 42;
11 }
12
13 macro_rules! gen_function {
14     () => {
15         fn fun_example(ref _x: usize) {}
16     };
17 }
18
19 fn main() {
20     let mut x = 0;
21     the_answer(x);
22
23     // lint in macro
24     #[allow(unused)]
25     {
26         gen_function!();
27     }
28
29     // do not lint in external macro
30     {
31         ref_arg_function!();
32     }
33 }