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