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