]> git.lizzy.rs Git - rust.git/blob - tests/ui/empty_line_after_outer_attribute.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / empty_line_after_outer_attribute.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![warn(clippy::empty_line_after_outer_attr)]
11
12 // This should produce a warning
13 #[crate_type = "lib"]
14
15 /// some comment
16 fn with_one_newline_and_comment() { assert!(true) }
17
18 // This should not produce a warning
19 #[crate_type = "lib"]
20 /// some comment
21 fn with_no_newline_and_comment() { assert!(true) }
22
23
24 // This should produce a warning
25 #[crate_type = "lib"]
26
27 fn with_one_newline() { assert!(true) }
28
29 // This should produce a warning, too
30 #[crate_type = "lib"]
31
32
33 fn with_two_newlines() { assert!(true) }
34
35
36 // This should produce a warning
37 #[crate_type = "lib"]
38
39 enum Baz {
40     One,
41     Two
42 }
43
44 // This should produce a warning
45 #[crate_type = "lib"]
46
47 struct Foo {
48     one: isize,
49     two: isize
50 }
51
52 // This should produce a warning
53 #[crate_type = "lib"]
54
55 mod foo {
56 }
57
58 /// This doc comment should not produce a warning
59
60 /** This is also a doc comment and should not produce a warning
61  */
62
63 // This should not produce a warning
64 #[allow(non_camel_case_types)]
65 #[allow(missing_docs)]
66 #[allow(missing_docs)]
67 fn three_attributes() { assert!(true) }
68
69 // This should not produce a warning
70 #[doc = "
71 Returns the escaped value of the textual representation of
72
73 "]
74 pub fn function() -> bool {
75     true
76 }
77
78 // This should not produce a warning
79 #[derive(Clone, Copy)]
80 pub enum FooFighter {
81     Bar1,
82
83     Bar2,
84
85     Bar3,
86
87     Bar4
88 }
89
90 // This should not produce a warning because the empty line is inside a block comment
91 #[crate_type = "lib"]
92 /*
93
94 */
95 pub struct S;
96
97 // This should not produce a warning
98 #[crate_type = "lib"]
99 /* test */
100 pub struct T;
101
102 fn main() { }