]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-ui/lint-missing-doc-code-example.rs
Auto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor
[rust.git] / src / test / rustdoc-ui / lint-missing-doc-code-example.rs
1 #![deny(missing_docs)]
2 #![deny(missing_doc_code_examples)]
3
4 //! crate level doc
5 //! ```
6 //! println!("hello"):
7 //! ```
8
9
10 /// doc
11 ///
12 /// ```
13 /// println!("hello");
14 /// ```
15 fn test() {
16 }
17
18 #[allow(missing_docs)]
19 mod module1 { //~ ERROR
20 }
21
22 #[allow(missing_doc_code_examples)]
23 /// doc
24 mod module2 {
25
26   /// doc
27   pub fn test() {}
28 }
29
30 /// doc
31 ///
32 /// ```
33 /// println!("hello");
34 /// ```
35 pub mod module3 {
36
37   /// doc
38   //~^ ERROR
39   pub fn test() {}
40 }
41
42 /// Doc, but no code example and it's fine!
43 pub const Const: u32 = 0;
44 /// Doc, but no code example and it's fine!
45 pub static Static: u32 = 0;
46 /// Doc, but no code example and it's fine!
47 pub type Type = u32;
48
49 /// Doc
50 //~^ ERROR
51 pub struct Struct {
52     /// Doc, but no code example and it's fine!
53     pub field: u32,
54 }
55
56 /// Doc
57 //~^ ERROR
58 pub enum Enum {
59     /// Doc, but no code example and it's fine!
60     X,
61 }
62
63 /// Doc
64 //~^ ERROR
65 #[repr(C)]
66 union Union {
67     /// Doc, but no code example and it's fine!
68     a: i32,
69     /// Doc, but no code example and it's fine!
70     b: f32,
71 }