#![forbid(warnings)]
#![allow(dead_code)]
struct Foo;
fn main() {}
Playground link
The above code should fail to compile with an error about trying to allow
a forbid
den lint, but successfully builds without any warnings. Tested on latest stable/beta/nightly.