2020-02-01 01:02:31 +03:00
|
|
|
#![feature(proc_macro_quote)]
|
2019-02-03 14:47:03 +01:00
|
|
|
#![deny(rust_2018_idioms)]
|
2019-12-30 17:02:18 +09:00
|
|
|
// FIXME: Remove this attribute once the weird failure is gone.
|
|
|
|
#![allow(unused_extern_crates)]
|
2017-12-20 08:16:43 -08:00
|
|
|
extern crate proc_macro;
|
2016-06-25 18:12:29 +02:00
|
|
|
|
2019-07-18 17:23:22 +02:00
|
|
|
use proc_macro::{quote, TokenStream};
|
2016-06-25 18:12:29 +02:00
|
|
|
|
2017-12-20 08:16:43 -08:00
|
|
|
#[proc_macro_derive(ClippyMiniMacroTest)]
|
2020-12-30 16:37:59 -06:00
|
|
|
/// # Panics
|
|
|
|
///
|
|
|
|
/// Panics if the macro derivation fails
|
2017-12-20 08:16:43 -08:00
|
|
|
pub fn mini_macro(_: TokenStream) -> TokenStream {
|
|
|
|
quote!(
|
2019-07-18 17:23:22 +02:00
|
|
|
#[allow(unused)]
|
|
|
|
fn needless_take_by_value(s: String) {
|
|
|
|
println!("{}", s.len());
|
|
|
|
}
|
|
|
|
#[allow(unused)]
|
|
|
|
fn needless_loop(items: &[u8]) {
|
2018-10-17 10:43:32 -04:00
|
|
|
for i in 0..items.len() {
|
|
|
|
println!("{}", items[i]);
|
|
|
|
}
|
|
|
|
}
|
2019-09-07 10:53:34 +07:00
|
|
|
fn line_wrapper() {
|
|
|
|
println!("{}", line!());
|
|
|
|
}
|
2017-12-20 08:16:43 -08:00
|
|
|
)
|
2018-10-05 15:52:51 +02:00
|
|
|
}
|