2023-04-20 10:19:36 -05:00
|
|
|
//@aux-build:proc_macros.rs:proc-macro
|
2020-10-24 03:50:11 -05:00
|
|
|
|
2019-09-23 04:19:24 -05:00
|
|
|
#![warn(clippy::toplevel_ref_arg)]
|
|
|
|
#![allow(unused)]
|
|
|
|
|
2023-03-07 08:40:55 -06:00
|
|
|
extern crate proc_macros;
|
|
|
|
use proc_macros::{external, inline_macros};
|
2020-10-24 03:50:11 -05:00
|
|
|
|
2019-09-23 04:19:24 -05:00
|
|
|
fn the_answer(ref mut x: u8) {
|
|
|
|
*x = 42;
|
|
|
|
}
|
|
|
|
|
2023-03-07 08:40:55 -06:00
|
|
|
#[inline_macros]
|
2019-09-23 04:19:24 -05:00
|
|
|
fn main() {
|
|
|
|
let mut x = 0;
|
|
|
|
the_answer(x);
|
2020-10-24 03:50:11 -05:00
|
|
|
|
|
|
|
// lint in macro
|
2023-03-07 08:40:55 -06:00
|
|
|
inline! {
|
|
|
|
fn fun_example(ref _x: usize) {}
|
2020-10-24 03:50:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// do not lint in external macro
|
2023-03-07 08:40:55 -06:00
|
|
|
external! {
|
|
|
|
fn fun_example2(ref _x: usize) {}
|
2020-10-24 03:50:11 -05:00
|
|
|
}
|
2019-09-23 04:19:24 -05:00
|
|
|
}
|