summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unused/unused-macros.rs
blob: 70b50b2082b36069d78f5710e125edf1c4729d7f (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
27
28
29
30
31
#![deny(unused_macros)]
// To make sure we are not hitting this
#![deny(unused_macro_rules)]

// Most simple case
macro_rules! unused { //~ ERROR: unused macro definition
    () => {};
}

// Test macros created by macros
macro_rules! create_macro {
    () => {
        macro_rules! m { //~ ERROR: unused macro definition
            () => {};
        }
    };
}
create_macro!();

#[allow(unused_macros)]
mod bar {
    // Test that putting the #[deny] close to the macro's definition
    // works.

    #[deny(unused_macros)]
    macro_rules! unused { //~ ERROR: unused macro definition
        () => {};
    }
}

fn main() {}