JelteF / derive_more

Some more derive(Trait) options
MIT License
1.74k stars 123 forks source link

Hide deprecation warnings inside derive expansions #419

Open aborgna-q opened 4 weeks ago

aborgna-q commented 4 weeks ago

Consider the following example:

use derive_more::Display;
#[derive(Debug, Display)]
pub enum Test {
    #[deprecated(note = "this is deprecated")]
    B { x: usize },
}

Compiling this produces a warning:

warning: use of deprecated field `derive_more_deprecate::Test::B::x`: this is deprecated
 --> src/derive_more_deprecate.rs:5:9
  |
5 |     B { x: usize },
  |         ^

Adding #[allow(deprecated)] does not help since the attribute does not get added to the impl Display.

This also happens with other derive macros (From, Error, ...).