Macros 如何禁用未使用的宏警告?

Macros 如何禁用未使用的宏警告?,macros,rust,Macros,Rust,此代码: #[allow(dead_code)] macro_rules! test { ($x:expr) => {{}} } fn main() { println!("Results:") } 生成有关未使用宏定义的以下警告: 警告:未使用的宏定义 -->/home/xxx/.emacs.d/rust playder/at-2017-08-02-031315/snippet.rs:10:1 | 10 |/macro_规则!试验{ 11 | |($x:expr)

此代码:

#[allow(dead_code)]
macro_rules! test {
    ($x:expr) => {{}}
}

fn main() {

    println!("Results:")

}
生成有关未使用宏定义的以下警告:

警告:未使用的宏定义
-->/home/xxx/.emacs.d/rust playder/at-2017-08-02-031315/snippet.rs:10:1
|
10 |/macro_规则!试验{
11 | |($x:expr)=>{{}
12 | | }
| |_^
|
=注意:#[警告(未使用的_宏)]默认打开

有可能压制它吗?如您所见,
#[allow(dead_code)
对宏没有帮助。

编译器警告状态:

= note: #[warn(unused_macros)] on by default
这与未使用功能引起的警告非常相似:

= note: #[warn(dead_code)] on by default
可以用相同的方法禁用这些警告,但需要使用匹配的宏属性:

#[allow(unused_macros)]
macro_rules! test {
    ($x:expr) => {{}}
}

我不知道是否生锈,但它看起来像是值得一试的
#[allow(unused#u macros)]