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