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