1 #![deny(unused_macro_rules)]
2 // To make sure we are not hitting this
3 #![deny(unused_macros)]
8 (two
) => { 2 }
; //~ ERROR: 2nd rule of macro
10 (four
) => { 4 }
; //~ ERROR: 4th rule of macro
12 const _NUM
: u8 = num
!(one
) + num
!(three
);
14 // Check that allowing the lint works
15 #[allow(unused_macro_rules)]
16 macro_rules
! num_allowed
{
22 const _NUM_ALLOWED
: u8 = num_allowed
!(one
) + num_allowed
!(three
);
24 // Check that macro calls inside the macro trigger as usage
25 macro_rules
! num_rec
{
28 num_rec
!(one
) + num_rec
!(one
)
30 (three
) => { //~ ERROR: 3rd rule of macro
31 num_rec
!(one
) + num_rec
!(two
)
33 (four
) => { num_rec!(two) + num_rec!(two) }
;
35 const _NUM_RECURSIVE
: u8 = num_rec
!(four
);
37 // No error if the macro is being exported
39 macro_rules
! num_exported
{
45 const _NUM_EXPORTED
: u8 = num_exported
!(one
) + num_exported
!(three
);