]> git.lizzy.rs Git - rust.git/blob - tests/ui/useless_attribute.fixed
iterate List by value
[rust.git] / tests / ui / useless_attribute.fixed
1 // run-rustfix
2 // aux-build:proc_macro_derive.rs
3
4 #![warn(clippy::useless_attribute)]
5 #![warn(unreachable_pub)]
6 #![feature(rustc_private)]
7
8 #![allow(dead_code)]
9 #![cfg_attr(feature = "cargo-clippy", allow(dead_code))]
10 #[rustfmt::skip]
11 #[allow(unused_imports)]
12 #[allow(unused_extern_crates)]
13 #[macro_use]
14 extern crate rustc_middle;
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 unused for `use` items
24 #[allow(unused)]
25 use std::option;
26
27 // don't lint on deprecated for `use` items
28 mod foo {
29     #[deprecated]
30     pub struct Bar;
31 }
32 #[allow(deprecated)]
33 pub use foo::Bar;
34
35 // This should not trigger the lint. There's lint level definitions inside the external derive
36 // that would trigger the useless_attribute lint.
37 #[derive(DeriveSomething)]
38 struct Baz;
39
40 // don't lint on unreachable_pub for `use` items
41 mod a {
42     mod b {
43         #[allow(dead_code)]
44         #[allow(unreachable_pub)]
45         pub struct C {}
46     }
47
48     #[allow(unreachable_pub)]
49     pub use self::b::C;
50 }
51
52 fn test_indented_attr() {
53     #![allow(clippy::almost_swapped)]
54     use std::collections::HashSet;
55
56     let _ = HashSet::<u32>::default();
57 }
58
59 fn main() {
60     test_indented_attr();
61 }