]> git.lizzy.rs Git - rust.git/blob - tests/ui/missing-doc.rs
iterate List by value
[rust.git] / tests / ui / missing-doc.rs
1 #![warn(clippy::missing_docs_in_private_items)]
2 // When denying at the crate level, be sure to not get random warnings from the
3 // injected intrinsics by the compiler.
4 #![allow(dead_code)]
5 #![feature(global_asm)]
6
7 //! Some garbage docs for the crate here
8 #![doc = "More garbage"]
9
10 type Typedef = String;
11 pub type PubTypedef = String;
12
13 mod module_no_dox {}
14 pub mod pub_module_no_dox {}
15
16 /// dox
17 pub fn foo() {}
18 pub fn foo2() {}
19 fn foo3() {}
20 #[allow(clippy::missing_docs_in_private_items)]
21 pub fn foo4() {}
22
23 // It sure is nice if doc(hidden) implies allow(missing_docs), and that it
24 // applies recursively
25 #[doc(hidden)]
26 mod a {
27     pub fn baz() {}
28     pub mod b {
29         pub fn baz() {}
30     }
31 }
32
33 enum Baz {
34     BazA { a: isize, b: isize },
35     BarB,
36 }
37
38 pub enum PubBaz {
39     PubBazA { a: isize },
40 }
41
42 /// dox
43 pub enum PubBaz2 {
44     /// dox
45     PubBaz2A {
46         /// dox
47         a: isize,
48     },
49 }
50
51 #[allow(clippy::missing_docs_in_private_items)]
52 pub enum PubBaz3 {
53     PubBaz3A { b: isize },
54 }
55
56 #[doc(hidden)]
57 pub fn baz() {}
58
59 const FOO: u32 = 0;
60 /// dox
61 pub const FOO1: u32 = 0;
62 #[allow(clippy::missing_docs_in_private_items)]
63 pub const FOO2: u32 = 0;
64 #[doc(hidden)]
65 pub const FOO3: u32 = 0;
66 pub const FOO4: u32 = 0;
67
68 static BAR: u32 = 0;
69 /// dox
70 pub static BAR1: u32 = 0;
71 #[allow(clippy::missing_docs_in_private_items)]
72 pub static BAR2: u32 = 0;
73 #[doc(hidden)]
74 pub static BAR3: u32 = 0;
75 pub static BAR4: u32 = 0;
76
77 mod internal_impl {
78     /// dox
79     pub fn documented() {}
80     pub fn undocumented1() {}
81     pub fn undocumented2() {}
82     fn undocumented3() {}
83     /// dox
84     pub mod globbed {
85         /// dox
86         pub fn also_documented() {}
87         pub fn also_undocumented1() {}
88         fn also_undocumented2() {}
89     }
90 }
91 /// dox
92 pub mod public_interface {
93     pub use internal_impl::documented as foo;
94     pub use internal_impl::globbed::*;
95     pub use internal_impl::undocumented1 as bar;
96     pub use internal_impl::{documented, undocumented2};
97 }
98
99 fn main() {}
100
101 // Ensure global asm doesn't require documentation.
102 global_asm! { "" }