2018-10-05 15:52:51 +02:00
|
|
|
#![feature(proc_macro_quote, proc_macro_hygiene)]
|
2019-02-03 14:47:03 +01:00
|
|
|
#![deny(rust_2018_idioms)]
|
2017-12-20 08:16:43 -08:00
|
|
|
extern crate proc_macro;
|
2016-06-25 18:12:29 +02:00
|
|
|
|
2017-12-20 08:16:43 -08:00
|
|
|
use proc_macro::{TokenStream, quote};
|
2016-06-25 18:12:29 +02:00
|
|
|
|
2017-12-20 08:16:43 -08:00
|
|
|
#[proc_macro_derive(ClippyMiniMacroTest)]
|
|
|
|
pub fn mini_macro(_: TokenStream) -> TokenStream {
|
|
|
|
quote!(
|
|
|
|
#[allow(unused)] fn needless_take_by_value(s: String) { println!("{}", s.len()); }
|
2018-10-17 10:43:32 -04:00
|
|
|
#[allow(unused)] fn needless_loop(items: &[u8]) {
|
|
|
|
for i in 0..items.len() {
|
|
|
|
println!("{}", items[i]);
|
|
|
|
}
|
|
|
|
}
|
2017-12-20 08:16:43 -08:00
|
|
|
)
|
2018-10-05 15:52:51 +02:00
|
|
|
}
|