summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/proc_macro.rs
blob: 59914b8b8f62729804879715e92d77c43a41a101 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Check that we correctly lint procedural macros.
#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[allow(dead_code)]
fn f() {
    let _x = 3.14;
}

#[proc_macro]
pub fn mybangmacro(t: TokenStream) -> TokenStream {
    t
}

#[proc_macro_derive(MyDerivedTrait)]
pub fn myderive(t: TokenStream) -> TokenStream {
    t
}

#[proc_macro_attribute]
pub fn myattribute(t: TokenStream, a: TokenStream) -> TokenStream {
    t
}