]> git.lizzy.rs Git - rust.git/blob - tests/ui/useless_attribute.rs
dd84b1b2c1c381570d276a43aa052d45b7cb01db
[rust.git] / tests / ui / useless_attribute.rs
1 // aux-build:proc_macro_derive.rs
2
3 #![warn(clippy::useless_attribute)]
4 #![warn(unreachable_pub)]
5
6 #[allow(dead_code)]
7 #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
8 #[rustfmt::skip]
9 #[cfg_attr(feature = "cargo-clippy",
10            allow(dead_code))]
11 #[allow(unused_imports)]
12 #[allow(unused_extern_crates)]
13 #[macro_use]
14 extern crate clippy_lints;
15
16 #[macro_use]
17 extern crate proc_macro_derive;
18
19 // don't lint on unused_import for `use` items
20 #[allow(unused_imports)]
21 use std::collections;
22
23 // don't lint on deprecated for `use` items
24 mod foo {
25     #[deprecated]
26     pub struct Bar;
27 }
28 #[allow(deprecated)]
29 pub use foo::Bar;
30
31 // This should not trigger the lint. There's lint level definitions inside the external derive
32 // that would trigger the useless_attribute lint.
33 #[derive(DeriveSomething)]
34 struct Baz;
35
36 // don't lint on unreachable_pub for `use` items
37 mod a {
38     mod b {
39         #[allow(dead_code)]
40         #[allow(unreachable_pub)]
41         pub struct C {}
42     }
43
44     #[allow(unreachable_pub)]
45     pub use self::b::C;
46 }
47
48 fn main() {}