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