]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/empty_line_after_outer_attribute.rs
Rollup merge of #78769 - est31:remove_lifetimes, r=KodrAus
[rust.git] / src / tools / clippy / tests / ui / empty_line_after_outer_attribute.rs
1 // aux-build:proc_macro_attr.rs
2 #![warn(clippy::empty_line_after_outer_attr)]
3 #![allow(clippy::assertions_on_constants)]
4 #![feature(custom_inner_attributes)]
5 #![rustfmt::skip]
6
7 #[macro_use]
8 extern crate proc_macro_attr;
9
10 // This should produce a warning
11 #[crate_type = "lib"]
12
13 /// some comment
14 fn with_one_newline_and_comment() { assert!(true) }
15
16 // This should not produce a warning
17 #[crate_type = "lib"]
18 /// some comment
19 fn with_no_newline_and_comment() { assert!(true) }
20
21
22 // This should produce a warning
23 #[crate_type = "lib"]
24
25 fn with_one_newline() { assert!(true) }
26
27 // This should produce a warning, too
28 #[crate_type = "lib"]
29
30
31 fn with_two_newlines() { assert!(true) }
32
33
34 // This should produce a warning
35 #[crate_type = "lib"]
36
37 enum Baz {
38     One,
39     Two
40 }
41
42 // This should produce a warning
43 #[crate_type = "lib"]
44
45 struct Foo {
46     one: isize,
47     two: isize
48 }
49
50 // This should produce a warning
51 #[crate_type = "lib"]
52
53 mod foo {
54 }
55
56 /// This doc comment should not produce a warning
57
58 /** This is also a doc comment and should not produce a warning
59  */
60
61 // This should not produce a warning
62 #[allow(non_camel_case_types)]
63 #[allow(missing_docs)]
64 #[allow(missing_docs)]
65 fn three_attributes() { assert!(true) }
66
67 // This should not produce a warning
68 #[doc = "
69 Returns the escaped value of the textual representation of
70
71 "]
72 pub fn function() -> bool {
73     true
74 }
75
76 // This should not produce a warning
77 #[derive(Clone, Copy)]
78 pub enum FooFighter {
79     Bar1,
80
81     Bar2,
82
83     Bar3,
84
85     Bar4
86 }
87
88 // This should not produce a warning because the empty line is inside a block comment
89 #[crate_type = "lib"]
90 /*
91
92 */
93 pub struct S;
94
95 // This should not produce a warning
96 #[crate_type = "lib"]
97 /* test */
98 pub struct T;
99
100 // This should not produce a warning
101 // See https://github.com/rust-lang/rust-clippy/issues/5567
102 #[fake_async_trait]
103 pub trait Bazz {
104     fn foo() -> Vec<u8> {
105         let _i = "";
106
107
108
109         vec![]
110     }
111 }
112
113 fn main() {}