我怎样才能使来自外部板条箱的宏中的 Rust 警告静音?

How can I silence Rust warnings in macros from external crates?

使用 claparg_enum 宏我收到此警告:

warning: use of deprecated item 'std::ascii::AsciiExt': use inherent methods instead
  --> src/main.rs:37:1
   |
37 | / arg_enum!{
38 | |     #[derive(Debug)]
39 | |     pub enum Operation {
40 | |         Add,
...  |
47 | |     }
48 | | }
   | |_^
   |
   = note: #[warn(deprecated)] on by default
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

如何让它静音?我试过将 #[allow(deprecated)] 放在 arg_enum! 之前和 extern crate clap; 之前,但都没有任何效果。

这似乎有 already been fixed,在 clap 的下一个版本中应该不会成为问题。在那之前,您可以使用 #![allow(deprecated)].

使警告静音

不,这还不可能。 Add macro checks to lints (issue #48855) 愿意添加此类功能。