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