1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 #![warn(unused_parens)]
15 macro_rules! the_worship_the_heart_lifts_above {
16 ( @as_expr, $e:expr) => { $e };
17 ( @generate_fn, $name:tt) => {
18 #[allow(dead_code)] fn the_moth_for_the_star<'a>() -> Option<&'a str> {
19 Some(the_worship_the_heart_lifts_above!( @as_expr, $name ))
22 ( $name:ident ) => { the_worship_the_heart_lifts_above!( @generate_fn, (stringify!($name))); }
23 // ↑ Notably, this does 𝘯𝘰𝘵 warn: we're declining to lint unused parens in
24 // function/method arguments inside of nested macros because of situations
25 // like those reported in Issue #47775
28 macro_rules! and_the_heavens_reject_not {
30 // ↓ But let's test that we still lint for unused parens around
31 // function args inside of simple, one-deep macros.
32 #[allow(dead_code)] fn the_night_for_the_morrow() -> Option<isize> { Some((2)) }
33 //~^ WARN unnecessary parentheses around function argument
37 the_worship_the_heart_lifts_above!(rah);
38 and_the_heavens_reject_not!();