1 //! This file tests for the DOC_MARKDOWN lint
4 #![warn(clippy::doc_markdown)]
6 /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
7 /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
8 /// which should be reported only once despite being __doubly bad__.
9 /// Here be ::a::global:path.
10 /// That's not code ~NotInCodeBlock~.
11 /// be_sure_we_got_to_the_end_of_it
15 /// That one tests multiline ticks.
25 /// be_sure_we_got_to_the_end_of_it
26 fn multiline_codeblock() {
29 /// This _is a test for
32 /// be_sure_we_got_to_the_end_of_it
36 /// This tests units. See also #835.
37 /// kiB MiB GiB TiB PiB EiB
38 /// kib Mib Gib Tib Pib Eib
41 /// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
42 /// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
43 /// 32kB 32MB 32GB 32TB 32PB 32EB
44 /// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
46 /// be_sure_we_got_to_the_end_of_it
50 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
51 /// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
52 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
53 /// It can also be [inline_link2].
55 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
56 /// [inline_link]: https://foobar
57 /// [inline_link2]: https://foobar
58 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
59 /// `multiline_ticks` functions.
61 /// expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
62 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
63 /// be_sure_we_got_to_the_end_of_it
66 multiline_codeblock();
72 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
76 /// Not a title #897 CamelCaseThing
77 /// be_sure_we_got_to_the_end_of_it
81 /// I am confused by brackets? (`x_y`)
82 /// I am confused by brackets? (foo `x_y`)
83 /// I am confused by brackets? (`x_y` foo)
84 /// be_sure_we_got_to_the_end_of_it
88 /// Diesel queries also have a similar problem to [Iterator][iterator], where
90 /// returning them from a function requires exposing the implementation of that
91 /// function. The [`helper_types`][helper_types] module exists to help with this,
92 /// but you might want to hide the return type or have it conditionally change.
93 /// Boxing can achieve both.
95 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
96 /// [helper_types]: ../helper_types/index.html
97 /// be_sure_we_got_to_the_end_of_it
104 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
108 /** E.g. serialization of an empty list: FooBar
110 That's in a code block: `PackedNode`
114 be_sure_we_got_to_the_end_of_it
119 /** E.g. serialization of an empty list: FooBar
121 That's in a code block: PackedNode
125 be_sure_we_got_to_the_end_of_it
130 /// Test more than three quotes:
136 /// be_sure_we_got_to_the_end_of_it
140 /// See [NIST SP 800-56A, revision 2].
142 /// [NIST SP 800-56A, revision 2]:
143 /// https://github.com/rust-lang/rust-clippy/issues/902#issuecomment-261919419
144 fn issue_902_comment() {}
146 #[cfg_attr(feature = "a", doc = " ```")]
147 #[cfg_attr(not(feature = "a"), doc = " ```ignore")]
149 /// let s = "localhost:10000".to_string();
150 /// println!("{}", s);
156 * This is a doc comment that should not be a list
157 *This would also be an error under a strict common mark interpretation
161 /// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
163 /// Not ok: http://www.unicode.org
164 /// Not ok: https://www.unicode.org
165 /// Not ok: http://www.unicode.org/
166 /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
169 /// Ok: CamelCase (It should not be surrounded by backticks)
172 /// An iterator over mycrate::Collection's values.
173 /// It should not lint a `'static` lifetime in ticks.
176 /// This should not cause the lint to trigger:
177 /// #REQ-data-family.lint_partof_exists