Sunday, July 17, 2022

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

Issue

Using clap's arg_enum macro I get this warning:

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)

How can I silence it? I've tried putting #[allow(deprecated)] before the arg_enum! and before the extern crate clap; but neither had any effect.


Solution

No, this is not possible yet. Add macro checks to lints (issue #48855) is open to add such functionality.



Answered By - Shepmaster
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.