fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.9 KiB226 linesraw
1
2//! This file tests for the `DOC_MARKDOWN` lint.
3
4#![allow(dead_code, incomplete_features)]
5#![warn(clippy::doc_markdown)]
6#![feature(custom_inner_attributes, generic_const_exprs, const_option)]
7#![rustfmt::skip]
8
9/// The `foo_bar` function does _nothing_. See also `foo::bar`. (note the dot there)
10/// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not `Foo::some_fun`
11/// which should be reported only once despite being __doubly bad__.
12/// Here be `::a::global:path`, and _`::another::global::path`_.  :: is not a path though.
13/// Import an item from `::awesome::global::blob::` (Intended postfix)
14/// These are the options for `::Cat`: (Intended trailing single colon, shouldn't be linted)
15/// That's not code ~`NotInCodeBlock`~.
16/// `be_sure_we_got_to_the_end_of_it`
17fn foo_bar() {
18}
19
20/// That one tests multiline ticks.
21/// ```rust
22/// foo_bar FOO_BAR
23/// _foo bar_
24/// ```
25///
26/// ~~~rust
27/// foo_bar FOO_BAR
28/// _foo bar_
29/// ~~~
30/// `be_sure_we_got_to_the_end_of_it`
31fn multiline_codeblock() {
32}
33
34/// This _is a test for
35/// multiline
36/// emphasis_.
37/// `be_sure_we_got_to_the_end_of_it`
38fn test_emphasis() {
39}
40
41/// This tests units. See also #835.
42/// kiB MiB GiB TiB PiB EiB
43/// kib Mib Gib Tib Pib Eib
44/// kB MB GB TB PB EB
45/// kb Mb Gb Tb Pb Eb
46/// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
47/// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
48/// 32kB 32MB 32GB 32TB 32PB 32EB
49/// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
50/// NaN
51/// `be_sure_we_got_to_the_end_of_it`
52fn test_units() {
53}
54
55/// This tests allowed identifiers.
56/// KiB MiB GiB TiB PiB EiB
57/// DirectX
58/// ECMAScript
59/// GPLv2 GPLv3
60/// GitHub GitLab
61/// IPv4 IPv6
62/// ClojureScript CoffeeScript JavaScript PureScript TypeScript
63/// WebAssembly
64/// NaN NaNs
65/// OAuth GraphQL
66/// OCaml
67/// OpenGL OpenMP OpenSSH OpenSSL OpenStreetMap OpenDNS
68/// WebGL
69/// TensorFlow
70/// TrueType
71/// iOS macOS FreeBSD
72/// TeX LaTeX BibTeX BibLaTeX
73/// MinGW
74/// CamelCase (see also #2395)
75/// `be_sure_we_got_to_the_end_of_it`
76fn test_allowed() {
77}
78
79/// This test has [a `link_with_underscores`][chunked-example] inside it. See #823.
80/// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
81/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
82/// It can also be [inline_link2]. A link to [StackOverflow](https://stackoverflow.com) is also acceptable.
83///
84/// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
85/// [inline_link]: https://foobar
86/// [inline_link2]: https://foobar
87/// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
88/// `multiline_ticks` functions.
89///
90/// expression of the type  `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
91/// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
92/// `be_sure_we_got_to_the_end_of_it`
93fn main() {
94    foo_bar();
95    multiline_codeblock();
96    test_emphasis();
97    test_units();
98}
99
100/// ## `CamelCaseThing`
101/// Talks about `CamelCaseThing`. Titles should be ignored; see issue #897.
102///
103/// # `CamelCaseThing`
104///
105/// Not a title #897 `CamelCaseThing`
106/// `be_sure_we_got_to_the_end_of_it`
107fn issue897() {
108}
109
110/// I am confused by brackets? (`x_y`)
111/// I am confused by brackets? (foo `x_y`)
112/// I am confused by brackets? (`x_y` foo)
113/// `be_sure_we_got_to_the_end_of_it`
114fn issue900() {
115}
116
117/// Diesel queries also have a similar problem to [Iterator][iterator], where
118/// /// More talking
119/// returning them from a function requires exposing the implementation of that
120/// function. The [`helper_types`][helper_types] module exists to help with this,
121/// but you might want to hide the return type or have it conditionally change.
122/// Boxing can achieve both.
123///
124/// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
125/// [helper_types]: ../helper_types/index.html
126/// `be_sure_we_got_to_the_end_of_it`
127fn issue883() {
128}
129
130/// `foo_bar
131/// baz_quz`
132/// [foo
133/// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
134fn multiline() {
135}
136
137/** E.g., serialization of an empty list: `FooBar`
138```
139That's in a code block: `PackedNode`
140```
141
142And `BarQuz` too.
143`be_sure_we_got_to_the_end_of_it`
144*/
145fn issue1073() {
146}
147
148/** E.g., serialization of an empty list: `FooBar`
149```
150That's in a code block: PackedNode
151```
152
153And `BarQuz` too.
154`be_sure_we_got_to_the_end_of_it`
155*/
156fn issue1073_alt() {
157}
158
159/// Tests more than three quotes:
160/// ````
161/// DoNotWarn
162/// ```
163/// StillDont
164/// ````
165/// `be_sure_we_got_to_the_end_of_it`
166fn four_quotes() {
167}
168
169#[cfg_attr(feature = "a", doc = " ```")]
170#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
171/// fn main() {
172///     let s = "localhost:10000".to_string();
173///     println!("{}", s);
174/// }
175/// ```
176fn issue_1469() {}
177
178/**
179 * This is a doc comment that should not be a list
180 *This would also be an error under a strict common mark interpretation
181 */
182fn issue_1920() {}
183
184/// An iterator over `mycrate::Collection`'s values.
185/// It should not lint a `'static` lifetime in ticks.
186fn issue_2210() {}
187
188/// This should not cause the lint to trigger:
189/// #REQ-data-family.lint_partof_exists
190fn issue_2343() {}
191
192/// This should not cause an ICE:
193/// __|_ _|__||_|
194fn pulldown_cmark_crash() {}
195
196/// This should not lint
197/// (regression test for #7758)
198/// [plain text][path::to::item]
199fn intra_doc_link() {}
200
201/// Ignore escaped\_underscores
202///
203/// \\[
204///     \\prod\_{x\\in X} p\_x
205/// \\]
206fn issue_2581() {}
207
208/// Foo \[bar\] \[baz\] \[qux\]. `DocMarkdownLint`
209fn lint_after_escaped_chars() {}
210
211// issue #7033 - generic_const_exprs ICE
212struct S<T, const N: usize>
213where [(); N.checked_next_power_of_two().unwrap()]: {
214    arr: [T; N.checked_next_power_of_two().unwrap()],
215    n: usize,
216}
217
218impl<T: Copy + Default, const N: usize> S<T, N>
219where [(); N.checked_next_power_of_two().unwrap()]: {
220    fn new() -> Self {
221        Self {
222            arr: [T::default(); N.checked_next_power_of_two().unwrap()],
223            n: 0,
224        }
225    }
226}