18 lines
508 B
Rust
Raw Normal View History

#![feature(proc_macro_quote, proc_macro_hygiene)]
#![deny(rust_2018_idioms)]
extern crate proc_macro;
2016-06-25 18:12:29 +02:00
use proc_macro::{TokenStream, quote};
2016-06-25 18:12:29 +02:00
#[proc_macro_derive(ClippyMiniMacroTest)]
pub fn mini_macro(_: TokenStream) -> TokenStream {
quote!(
#[allow(unused)] fn needless_take_by_value(s: String) { println!("{}", s.len()); }
#[allow(unused)] fn needless_loop(items: &[u8]) {
for i in 0..items.len() {
println!("{}", items[i]);
}
}
)
}