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