]> git.lizzy.rs Git - rust.git/blob - clippy_tests/examples/doc.rs
Merge remote-tracking branch 'origin/master' into testing_refactor
[rust.git] / clippy_tests / examples / doc.rs
1 //! This file tests for the DOC_MARKDOWN lint
2
3 #![feature(plugin)]
4 #![plugin(clippy)]
5
6 #![warn(doc_markdown)]
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 ::is::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 one checks we don’t try to split unicode codepoints
53 /// `ß`
54 /// `ℝ`
55 /// `💣`
56 /// `❤️`
57 /// ß_foo
58 /// ℝ_foo
59 /// 💣_foo
60 /// ❤️_foo
61 /// foo_ß
62 /// foo_ℝ
63 /// foo_💣
64 /// foo_❤️
65 /// [ßdummy textß][foo_1ß]
66 /// [ℝdummy textℝ][foo_2ℝ]
67 /// [💣dummy tex💣t][foo3_💣]
68 /// [❤️dummy text❤️][foo_4❤️]
69 /// [ßdummy textß](foo_5ß)
70 /// [ℝdummy textℝ](foo_6ℝ)
71 /// [💣dummy tex💣t](fo7o_💣)
72 /// [❤️dummy text❤️](foo_8❤️)
73 /// [foo1_ß]: dummy text
74 /// [foo2_ℝ]: dummy text
75 /// [foo3_💣]: dummy text
76 /// [foo4_❤️]: dummy text
77 /// be_sure_we_got_to_the_end_of_it
78 fn test_unicode() {
79 }
80
81 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
82 /// See also [the issue tracker](https://github.com/Manishearth/rust-clippy/search?q=doc_markdown&type=Issues)
83 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
84 /// It can also be [inline_link2].
85 ///
86 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
87 /// [inline_link]: https://foobar
88 /// [inline_link2]: https://foobar
89 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
90 /// `multiline_ticks` functions.
91 ///
92 /// expression of the type  `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
93 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
94 /// be_sure_we_got_to_the_end_of_it
95 fn main() {
96     foo_bar();
97     multiline_codeblock();
98     test_emphasis();
99     test_units();
100 }
101
102 /// ## CamelCaseThing
103 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
104 ///
105 /// # CamelCaseThing
106 ///
107 /// Not a title #897 CamelCaseThing
108 /// be_sure_we_got_to_the_end_of_it
109 fn issue897() {
110 }
111
112 /// I am confused by brackets? (`x_y`)
113 /// I am confused by brackets? (foo `x_y`)
114 /// I am confused by brackets? (`x_y` foo)
115 /// be_sure_we_got_to_the_end_of_it
116 fn issue900() {
117 }
118
119 /// Diesel queries also have a similar problem to [Iterator][iterator], where
120 /// /// More talking
121 /// returning them from a function requires exposing the implementation of that
122 /// function. The [`helper_types`][helper_types] module exists to help with this,
123 /// but you might want to hide the return type or have it conditionally change.
124 /// Boxing can achieve both.
125 ///
126 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
127 /// [helper_types]: ../helper_types/index.html
128 /// be_sure_we_got_to_the_end_of_it
129 fn issue883() {
130 }
131
132 /// `foo_bar
133 /// baz_quz`
134 /// [foo
135 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
136 fn multiline() {
137 }
138
139 /** E.g. serialization of an empty list: FooBar
140 ```
141 That's in a code block: `PackedNode`
142 ```
143
144 And BarQuz too.
145 be_sure_we_got_to_the_end_of_it
146 */
147 fn issue1073() {
148 }
149
150 /** E.g. serialization of an empty list: FooBar
151 ```
152 That's in a code block: PackedNode
153 ```
154
155 And BarQuz too.
156 be_sure_we_got_to_the_end_of_it
157 */
158 fn issue1073_alt() {
159 }
160
161 /// Test more than three quotes:
162 /// ````
163 /// DoNotWarn
164 /// ```
165 /// StillDont
166 /// ````
167 /// be_sure_we_got_to_the_end_of_it
168 fn four_quotes() {
169 }