]> git.lizzy.rs Git - rust.git/blob - tests/ui/missing-doc.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / missing-doc.rs
1 #![feature(tool_lints)]
2
3 /* This file incorporates work covered by the following copyright and
4  * permission notice:
5  *   Copyright 2013 The Rust Project Developers. See the COPYRIGHT
6  *   file at the top-level directory of this distribution and at
7  *   http://rust-lang.org/COPYRIGHT.
8  *
9  *   Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
10  *   http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
11  *   <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
12  *   option. This file may not be copied, modified, or distributed
13  *   except according to those terms.
14  */
15
16
17
18 #![warn(clippy::missing_docs_in_private_items)]
19
20 // When denying at the crate level, be sure to not get random warnings from the
21 // injected intrinsics by the compiler.
22 #![allow(dead_code)]
23 #![feature(associated_type_defaults)]
24
25 //! Some garbage docs for the crate here
26 #![doc="More garbage"]
27
28 type Typedef = String;
29 pub type PubTypedef = String;
30
31 struct Foo {
32     a: isize,
33     b: isize,
34 }
35
36 pub struct PubFoo {
37     pub a: isize,
38     b: isize,
39 }
40
41 #[allow(clippy::missing_docs_in_private_items)]
42 pub struct PubFoo2 {
43     pub a: isize,
44     pub c: isize,
45 }
46
47 mod module_no_dox {}
48 pub mod pub_module_no_dox {}
49
50 /// dox
51 pub fn foo() {}
52 pub fn foo2() {}
53 fn foo3() {}
54 #[allow(clippy::missing_docs_in_private_items)] pub fn foo4() {}
55
56 /// dox
57 pub trait A {
58     /// dox
59     fn foo(&self);
60     /// dox
61     fn foo_with_impl(&self) {}
62 }
63
64 #[allow(clippy::missing_docs_in_private_items)]
65 trait B {
66     fn foo(&self);
67     fn foo_with_impl(&self) {}
68 }
69
70 pub trait C {
71     fn foo(&self);
72     fn foo_with_impl(&self) {}
73 }
74
75 #[allow(clippy::missing_docs_in_private_items)]
76 pub trait D {
77     fn dummy(&self) { }
78 }
79
80 /// dox
81 pub trait E {
82     type AssociatedType;
83     type AssociatedTypeDef = Self;
84
85     /// dox
86     type DocumentedType;
87     /// dox
88     type DocumentedTypeDef = Self;
89     /// dox
90     fn dummy(&self) {}
91 }
92
93 impl Foo {
94     pub fn foo() {}
95     fn bar() {}
96 }
97
98 impl PubFoo {
99     pub fn foo() {}
100     /// dox
101     pub fn foo1() {}
102     fn foo2() {}
103     #[allow(clippy::missing_docs_in_private_items)] pub fn foo3() {}
104 }
105
106 #[allow(clippy::missing_docs_in_private_items)]
107 trait F {
108     fn a();
109     fn b(&self);
110 }
111
112 // should need to redefine documentation for implementations of traits
113 impl F for Foo {
114     fn a() {}
115     fn b(&self) {}
116 }
117
118 // It sure is nice if doc(hidden) implies allow(missing_docs), and that it
119 // applies recursively
120 #[doc(hidden)]
121 mod a {
122     pub fn baz() {}
123     pub mod b {
124         pub fn baz() {}
125     }
126 }
127
128 enum Baz {
129     BazA {
130         a: isize,
131         b: isize
132     },
133     BarB
134 }
135
136 pub enum PubBaz {
137     PubBazA {
138         a: isize,
139     },
140 }
141
142 /// dox
143 pub enum PubBaz2 {
144     /// dox
145     PubBaz2A {
146         /// dox
147         a: isize,
148     },
149 }
150
151 #[allow(clippy::missing_docs_in_private_items)]
152 pub enum PubBaz3 {
153     PubBaz3A {
154         b: isize
155     },
156 }
157
158 #[doc(hidden)]
159 pub fn baz() {}
160
161
162 const FOO: u32 = 0;
163 /// dox
164 pub const FOO1: u32 = 0;
165 #[allow(clippy::missing_docs_in_private_items)]
166 pub const FOO2: u32 = 0;
167 #[doc(hidden)]
168 pub const FOO3: u32 = 0;
169 pub const FOO4: u32 = 0;
170
171
172 static BAR: u32 = 0;
173 /// dox
174 pub static BAR1: u32 = 0;
175 #[allow(clippy::missing_docs_in_private_items)]
176 pub static BAR2: u32 = 0;
177 #[doc(hidden)]
178 pub static BAR3: u32 = 0;
179 pub static BAR4: u32 = 0;
180
181
182 mod internal_impl {
183     /// dox
184     pub fn documented() {}
185     pub fn undocumented1() {}
186     pub fn undocumented2() {}
187     fn undocumented3() {}
188     /// dox
189     pub mod globbed {
190         /// dox
191         pub fn also_documented() {}
192         pub fn also_undocumented1() {}
193         fn also_undocumented2() {}
194     }
195 }
196 /// dox
197 pub mod public_interface {
198     pub use internal_impl::documented as foo;
199     pub use internal_impl::undocumented1 as bar;
200     pub use internal_impl::{documented, undocumented2};
201     pub use internal_impl::globbed::*;
202 }
203
204 fn main() {}