1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
11 #![feature(tool_lints)]
13 //! This file tests for the DOC_MARKDOWN lint
18 #![warn(clippy::doc_markdown)]
20 /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
21 /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
22 /// which should be reported only once despite being __doubly bad__.
23 /// Here be ::a::global:path.
24 /// That's not code ~NotInCodeBlock~.
25 /// be_sure_we_got_to_the_end_of_it
29 /// That one tests multiline ticks.
39 /// be_sure_we_got_to_the_end_of_it
40 fn multiline_codeblock() {
43 /// This _is a test for
46 /// be_sure_we_got_to_the_end_of_it
50 /// This tests units. See also #835.
51 /// kiB MiB GiB TiB PiB EiB
52 /// kib Mib Gib Tib Pib Eib
55 /// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
56 /// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
57 /// 32kB 32MB 32GB 32TB 32PB 32EB
58 /// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
60 /// be_sure_we_got_to_the_end_of_it
64 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
65 /// See also [the issue tracker](https://github.com/rust-lang-nursery/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
66 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
67 /// It can also be [inline_link2].
69 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
70 /// [inline_link]: https://foobar
71 /// [inline_link2]: https://foobar
72 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
73 /// `multiline_ticks` functions.
75 /// expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
76 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
77 /// be_sure_we_got_to_the_end_of_it
80 multiline_codeblock();
86 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
90 /// Not a title #897 CamelCaseThing
91 /// be_sure_we_got_to_the_end_of_it
95 /// I am confused by brackets? (`x_y`)
96 /// I am confused by brackets? (foo `x_y`)
97 /// I am confused by brackets? (`x_y` foo)
98 /// be_sure_we_got_to_the_end_of_it
102 /// Diesel queries also have a similar problem to [Iterator][iterator], where
104 /// returning them from a function requires exposing the implementation of that
105 /// function. The [`helper_types`][helper_types] module exists to help with this,
106 /// but you might want to hide the return type or have it conditionally change.
107 /// Boxing can achieve both.
109 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
110 /// [helper_types]: ../helper_types/index.html
111 /// be_sure_we_got_to_the_end_of_it
118 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
122 /** E.g. serialization of an empty list: FooBar
124 That's in a code block: `PackedNode`
128 be_sure_we_got_to_the_end_of_it
133 /** E.g. serialization of an empty list: FooBar
135 That's in a code block: PackedNode
139 be_sure_we_got_to_the_end_of_it
144 /// Test more than three quotes:
150 /// be_sure_we_got_to_the_end_of_it
154 /// See [NIST SP 800-56A, revision 2].
156 /// [NIST SP 800-56A, revision 2]:
157 /// https://github.com/rust-lang-nursery/rust-clippy/issues/902#issuecomment-261919419
158 fn issue_902_comment() {}
160 #[cfg_attr(feature = "a", doc = " ```")]
161 #[cfg_attr(not(feature = "a"), doc = " ```ignore")]
163 /// let s = "localhost:10000".to_string();
164 /// println!("{}", s);
170 * This is a doc comment that should not be a list
171 *This would also be an error under a strict common mark interpretation
175 /// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
177 /// Not ok: http://www.unicode.org
178 /// Not ok: https://www.unicode.org
179 /// Not ok: http://www.unicode.org/
180 /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels