]> git.lizzy.rs Git - rust.git/blob - tests/ui/empty_line_after_outer_attribute.rs
Merge pull request #3265 from mikerite/fix-export
[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
11 #![feature(tool_lints)]
12 #![warn(clippy::empty_line_after_outer_attr)]
13
14 // This should produce a warning
15 #[crate_type = "lib"]
16
17 /// some comment
18 fn with_one_newline_and_comment() { assert!(true) }
19
20 // This should not produce a warning
21 #[crate_type = "lib"]
22 /// some comment
23 fn with_no_newline_and_comment() { assert!(true) }
24
25
26 // This should produce a warning
27 #[crate_type = "lib"]
28
29 fn with_one_newline() { assert!(true) }
30
31 // This should produce a warning, too
32 #[crate_type = "lib"]
33
34
35 fn with_two_newlines() { assert!(true) }
36
37
38 // This should produce a warning
39 #[crate_type = "lib"]
40
41 enum Baz {
42     One,
43     Two
44 }
45
46 // This should produce a warning
47 #[crate_type = "lib"]
48
49 struct Foo {
50     one: isize,
51     two: isize
52 }
53
54 // This should produce a warning
55 #[crate_type = "lib"]
56
57 mod foo {
58 }
59
60 /// This doc comment should not produce a warning
61
62 /** This is also a doc comment and should not produce a warning
63  */
64
65 // This should not produce a warning
66 #[allow(non_camel_case_types)]
67 #[allow(missing_docs)]
68 #[allow(missing_docs)]
69 fn three_attributes() { assert!(true) }
70
71 // This should not produce a warning
72 #[doc = "
73 Returns the escaped value of the textual representation of
74
75 "]
76 pub fn function() -> bool {
77     true
78 }
79
80 // This should not produce a warning
81 #[derive(Clone, Copy)]
82 pub enum FooFighter {
83     Bar1,
84
85     Bar2,
86
87     Bar3,
88
89     Bar4
90 }
91
92 // This should not produce a warning because the empty line is inside a block comment
93 #[crate_type = "lib"]
94 /*
95
96 */
97 pub struct S;
98
99 // This should not produce a warning
100 #[crate_type = "lib"]
101 /* test */
102 pub struct T;
103
104 fn main() { }