1 //! This file tests for the `DOC_MARKDOWN` lint.
4 #![warn(clippy::doc_markdown)]
5 #![feature(custom_inner_attributes)]
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 ::a::global:path.
12 /// That's not code ~NotInCodeBlock~.
13 /// be_sure_we_got_to_the_end_of_it
17 /// That one tests multiline ticks.
27 /// be_sure_we_got_to_the_end_of_it
28 fn multiline_codeblock() {
31 /// This _is a test for
34 /// be_sure_we_got_to_the_end_of_it
38 /// This tests units. See also #835.
39 /// kiB MiB GiB TiB PiB EiB
40 /// kib Mib Gib Tib Pib Eib
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
48 /// be_sure_we_got_to_the_end_of_it
52 /// This tests allowed identifiers.
56 /// TeX LaTeX BibTeX BibLaTeX
57 /// CamelCase (see also #2395)
58 /// be_sure_we_got_to_the_end_of_it
62 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
63 /// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
64 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
65 /// It can also be [inline_link2].
67 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
68 /// [inline_link]: https://foobar
69 /// [inline_link2]: https://foobar
70 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
71 /// `multiline_ticks` functions.
73 /// expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
74 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
75 /// be_sure_we_got_to_the_end_of_it
78 multiline_codeblock();
84 /// Talks about `CamelCaseThing`. Titles should be ignored; see issue #897.
88 /// Not a title #897 CamelCaseThing
89 /// be_sure_we_got_to_the_end_of_it
93 /// I am confused by brackets? (`x_y`)
94 /// I am confused by brackets? (foo `x_y`)
95 /// I am confused by brackets? (`x_y` foo)
96 /// be_sure_we_got_to_the_end_of_it
100 /// Diesel queries also have a similar problem to [Iterator][iterator], where
102 /// returning them from a function requires exposing the implementation of that
103 /// function. The [`helper_types`][helper_types] module exists to help with this,
104 /// but you might want to hide the return type or have it conditionally change.
105 /// Boxing can achieve both.
107 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
108 /// [helper_types]: ../helper_types/index.html
109 /// be_sure_we_got_to_the_end_of_it
116 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
120 /** E.g., serialization of an empty list: FooBar
122 That's in a code block: `PackedNode`
126 be_sure_we_got_to_the_end_of_it
131 /** E.g., serialization of an empty list: FooBar
133 That's in a code block: PackedNode
137 be_sure_we_got_to_the_end_of_it
142 /// Tests more than three quotes:
148 /// be_sure_we_got_to_the_end_of_it
152 /// See [NIST SP 800-56A, revision 2].
154 /// [NIST SP 800-56A, revision 2]:
155 /// https://github.com/rust-lang/rust-clippy/issues/902#issuecomment-261919419
156 fn issue_902_comment() {}
158 #[cfg_attr(feature = "a", doc = " ```")]
159 #[cfg_attr(not(feature = "a"), doc = " ```ignore")]
161 /// let s = "localhost:10000".to_string();
162 /// println!("{}", s);
168 * This is a doc comment that should not be a list
169 *This would also be an error under a strict common mark interpretation
173 /// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
175 /// Not ok: http://www.unicode.org
176 /// Not ok: https://www.unicode.org
177 /// Not ok: http://www.unicode.org/
178 /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
181 /// An iterator over mycrate::Collection's values.
182 /// It should not lint a `'static` lifetime in ticks.
185 /// This should not cause the lint to trigger:
186 /// #REQ-data-family.lint_partof_exists
189 /// This should not cause an ICE:
191 fn pulldown_cmark_crash() {}