File: issue-47775-nested-macro-unnecessary-parens-arg.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (27 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (6)
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
//@ check-pass

#![warn(unused_parens)]

macro_rules! the_worship_the_heart_lifts_above {
    ( @as_expr, $e:expr) => { $e };
    ( @generate_fn, $name:tt) => {
        #[allow(dead_code)] fn the_moth_for_the_star<'a>() -> Option<&'a str> {
            Some(the_worship_the_heart_lifts_above!( @as_expr, $name ))
        }
    };
    ( $name:ident ) => { the_worship_the_heart_lifts_above!( @generate_fn, (stringify!($name))); }
    // ↑ Notably, this does 𝘯𝘰𝘵 warn: we're declining to lint unused parens in
    // function/method arguments inside of nested macros because of situations
    // like those reported in Issue #47775
}

macro_rules! and_the_heavens_reject_not {
    () => {
        #[allow(dead_code)] fn the_night_for_the_morrow() -> Option<isize> { Some((2)) }
    }
}

the_worship_the_heart_lifts_above!(rah);
and_the_heavens_reject_not!();

fn main() {}