]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/doc.rs
d3b1c037f4702c185c0f190ba2694400ac236a91
[rust.git] / tests / compile-fail / doc.rs
1 //! This file tests for the DOC_MARKDOWN lint
2 //~^ ERROR: you should put `DOC_MARKDOWN` between ticks
3
4 #![feature(plugin)]
5 #![plugin(clippy)]
6
7 #![deny(doc_markdown)]
8
9 /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
10 //~^ ERROR: you should put `foo_bar` between ticks
11 //~| ERROR: you should put `foo::bar` between ticks
12 /// Markdown is _weird_. I mean _really weird_.  This \_ is ok. So is `_`. But not Foo::some_fun
13 //~^ ERROR: you should put `Foo::some_fun` between ticks
14 /// which should be reported only once despite being __doubly bad__.
15 /// Here be ::is::a::global:path.
16 //~^ ERROR: you should put `is::a::global:path` between ticks
17 /// be_sure_we_got_to_the_end_of_it
18 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
19 fn foo_bar() {
20 }
21
22 /// That one tests multiline ticks.
23 /// ```rust
24 /// foo_bar FOO_BAR
25 /// _foo bar_
26 /// ```
27 /// be_sure_we_got_to_the_end_of_it
28 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
29 fn multiline_ticks() {
30 }
31
32 /// This _is a test for
33 /// multiline
34 /// emphasis_.
35 /// be_sure_we_got_to_the_end_of_it
36 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
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 /// be_sure_we_got_to_the_end_of_it
50 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
51 fn test_units() {
52 }
53
54 /// This one checks we don’t try to split unicode codepoints
55 /// `ß`
56 /// `ℝ`
57 /// `💣`
58 /// `❤️`
59 /// ß_foo
60 //~^ ERROR: you should put `ß_foo` between ticks
61 /// ℝ_foo
62 //~^ ERROR: you should put `ℝ_foo` between ticks
63 /// 💣_foo
64 /// ❤️_foo
65 /// foo_ß
66 //~^ ERROR: you should put `foo_ß` between ticks
67 /// foo_ℝ
68 //~^ ERROR: you should put `foo_ℝ` between ticks
69 /// foo_💣
70 /// foo_❤️
71 /// [ßdummy textß][foo_1ß]
72 /// [ℝdummy textℝ][foo_2ℝ]
73 /// [💣dummy tex💣t][foo3_💣]
74 /// [❤️dummy text❤️][foo_4❤️]
75 /// [ßdummy textß](foo_5ß)
76 /// [ℝdummy textℝ](foo_6ℝ)
77 /// [💣dummy tex💣t](fo7o_💣)
78 /// [❤️dummy text❤️](foo_8❤️)
79 /// [foo1_ß]: dummy text
80 /// [foo2_ℝ]: dummy text
81 /// [foo3_💣]: dummy text
82 /// [foo4_❤️]: dummy text
83 /// be_sure_we_got_to_the_end_of_it
84 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
85 fn test_unicode() {
86 }
87
88 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
89 //~^ ERROR: you should put `link_with_underscores` between ticks
90 /// See also [the issue tracker](https://github.com/Manishearth/rust-clippy/search?q=doc_markdown&type=Issues)
91 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
92 /// It can also be [inline_link2].
93 //~^ ERROR: you should put `inline_link2` between ticks
94 ///
95 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
96 /// [inline_link]: https://foobar
97 /// [inline_link2]: https://foobar
98
99 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
100 /// `multiline_ticks` functions.
101 ///
102 /// expression of the type  `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
103 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
104 /// be_sure_we_got_to_the_end_of_it
105 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
106 fn main() {
107     foo_bar();
108     multiline_ticks();
109     test_emphasis();
110     test_units();
111 }
112
113 /// ## CamelCaseThing
114 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
115 ///
116 /// # CamelCaseThing
117 ///
118 /// Not a title #897 CamelCaseThing
119 //~^ ERROR: you should put `CamelCaseThing` between ticks
120 /// be_sure_we_got_to_the_end_of_it
121 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
122 fn issue897() {
123 }
124
125 /// I am confused by brackets? (`x_y`)
126 /// I am confused by brackets? (foo `x_y`)
127 /// I am confused by brackets? (`x_y` foo)
128 /// be_sure_we_got_to_the_end_of_it
129 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
130 fn issue900() {
131 }
132
133 /// Diesel queries also have a similar problem to [Iterator][iterator], where
134 /// /// More talking
135 /// returning them from a function requires exposing the implementation of that
136 /// function. The [`helper_types`][helper_types] module exists to help with this,
137 /// but you might want to hide the return type or have it conditionally change.
138 /// Boxing can achieve both.
139 ///
140 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
141 /// [helper_types]: ../helper_types/index.html
142 /// be_sure_we_got_to_the_end_of_it
143 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
144 fn issue883() {
145 }
146
147 /// `foo_bar
148 /// baz_quz`
149 /// [foo
150 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
151 fn multiline() {
152 }