]> git.lizzy.rs Git - rust.git/blob - tests/ui/doc.rs
Auto merge of #3645 - phansch:remove_copyright_headers, r=oli-obk
[rust.git] / tests / ui / doc.rs
1 //! This file tests for the DOC_MARKDOWN lint
2
3 #![allow(dead_code)]
4 #![warn(clippy::doc_markdown)]
5
6 /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
7 /// Markdown is _weird_. I mean _really weird_.  This \_ is ok. So is `_`. But not Foo::some_fun
8 /// which should be reported only once despite being __doubly bad__.
9 /// Here be ::a::global:path.
10 /// That's not code ~NotInCodeBlock~.
11 /// be_sure_we_got_to_the_end_of_it
12 fn foo_bar() {
13 }
14
15 /// That one tests multiline ticks.
16 /// ```rust
17 /// foo_bar FOO_BAR
18 /// _foo bar_
19 /// ```
20 ///
21 /// ~~~rust
22 /// foo_bar FOO_BAR
23 /// _foo bar_
24 /// ~~~
25 /// be_sure_we_got_to_the_end_of_it
26 fn multiline_codeblock() {
27 }
28
29 /// This _is a test for
30 /// multiline
31 /// emphasis_.
32 /// be_sure_we_got_to_the_end_of_it
33 fn test_emphasis() {
34 }
35
36 /// This tests units. See also #835.
37 /// kiB MiB GiB TiB PiB EiB
38 /// kib Mib Gib Tib Pib Eib
39 /// kB MB GB TB PB EB
40 /// kb Mb Gb Tb Pb Eb
41 /// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
42 /// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
43 /// 32kB 32MB 32GB 32TB 32PB 32EB
44 /// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
45 /// NaN
46 /// be_sure_we_got_to_the_end_of_it
47 fn test_units() {
48 }
49
50 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
51 /// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
52 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
53 /// It can also be [inline_link2].
54 ///
55 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
56 /// [inline_link]: https://foobar
57 /// [inline_link2]: https://foobar
58 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
59 /// `multiline_ticks` functions.
60 ///
61 /// expression of the type  `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
62 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
63 /// be_sure_we_got_to_the_end_of_it
64 fn main() {
65     foo_bar();
66     multiline_codeblock();
67     test_emphasis();
68     test_units();
69 }
70
71 /// ## CamelCaseThing
72 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
73 ///
74 /// # CamelCaseThing
75 ///
76 /// Not a title #897 CamelCaseThing
77 /// be_sure_we_got_to_the_end_of_it
78 fn issue897() {
79 }
80
81 /// I am confused by brackets? (`x_y`)
82 /// I am confused by brackets? (foo `x_y`)
83 /// I am confused by brackets? (`x_y` foo)
84 /// be_sure_we_got_to_the_end_of_it
85 fn issue900() {
86 }
87
88 /// Diesel queries also have a similar problem to [Iterator][iterator], where
89 /// /// More talking
90 /// returning them from a function requires exposing the implementation of that
91 /// function. The [`helper_types`][helper_types] module exists to help with this,
92 /// but you might want to hide the return type or have it conditionally change.
93 /// Boxing can achieve both.
94 ///
95 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
96 /// [helper_types]: ../helper_types/index.html
97 /// be_sure_we_got_to_the_end_of_it
98 fn issue883() {
99 }
100
101 /// `foo_bar
102 /// baz_quz`
103 /// [foo
104 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
105 fn multiline() {
106 }
107
108 /** E.g. serialization of an empty list: FooBar
109 ```
110 That's in a code block: `PackedNode`
111 ```
112
113 And BarQuz too.
114 be_sure_we_got_to_the_end_of_it
115 */
116 fn issue1073() {
117 }
118
119 /** E.g. serialization of an empty list: FooBar
120 ```
121 That's in a code block: PackedNode
122 ```
123
124 And BarQuz too.
125 be_sure_we_got_to_the_end_of_it
126 */
127 fn issue1073_alt() {
128 }
129
130 /// Test more than three quotes:
131 /// ````
132 /// DoNotWarn
133 /// ```
134 /// StillDont
135 /// ````
136 /// be_sure_we_got_to_the_end_of_it
137 fn four_quotes() {
138 }
139
140 /// See [NIST SP 800-56A, revision 2].
141 ///
142 /// [NIST SP 800-56A, revision 2]:
143 ///     https://github.com/rust-lang/rust-clippy/issues/902#issuecomment-261919419
144 fn issue_902_comment() {}
145
146 #[cfg_attr(feature = "a", doc = " ```")]
147 #[cfg_attr(not(feature = "a"), doc = " ```ignore")]
148 /// fn main() {
149 ///     let s = "localhost:10000".to_string();
150 ///     println!("{}", s);
151 /// }
152 /// ```
153 fn issue_1469() {}
154
155 /**
156  * This is a doc comment that should not be a list
157  *This would also be an error under a strict common mark interpretation
158  */
159 fn issue_1920() {}
160
161 /// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
162 ///
163 /// Not ok: http://www.unicode.org
164 /// Not ok: https://www.unicode.org
165 /// Not ok: http://www.unicode.org/
166 /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
167 fn issue_1832() {}
168
169 /// Ok: CamelCase (It should not be surrounded by backticks)
170 fn issue_2395() {}
171
172 /// An iterator over mycrate::Collection's values.
173 /// It should not lint a `'static` lifetime in ticks.
174 fn issue_2210() {}
175
176 /// This should not cause the lint to trigger:
177 /// #REQ-data-family.lint_partof_exists
178 fn issue_2343() {}