2023-08-24 14:32:12 -05:00
|
|
|
|
2019-01-30 19:15:29 -06:00
|
|
|
//! This file tests for the `DOC_MARKDOWN` lint.
|
2017-02-08 07:58:07 -06:00
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
#![allow(dead_code, incomplete_features)]
|
2018-07-28 10:34:52 -05:00
|
|
|
#![warn(clippy::doc_markdown)]
|
2024-10-01 16:11:48 -05:00
|
|
|
#![feature(custom_inner_attributes, generic_const_exprs)]
|
2019-03-07 00:03:15 -06:00
|
|
|
#![rustfmt::skip]
|
2016-03-19 11:59:12 -05:00
|
|
|
|
2016-03-28 11:00:24 -05:00
|
|
|
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
2019-01-30 19:15:29 -06:00
|
|
|
/// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
|
2016-03-28 11:00:24 -05:00
|
|
|
/// which should be reported only once despite being __doubly bad__.
|
2021-11-04 07:52:36 -05:00
|
|
|
/// Here be ::a::global:path, and _::another::global::path_. :: is not a path though.
|
|
|
|
/// Import an item from ::awesome::global::blob:: (Intended postfix)
|
|
|
|
/// These are the options for ::Cat: (Intended trailing single colon, shouldn't be linted)
|
2016-07-08 11:18:45 -05:00
|
|
|
/// That's not code ~NotInCodeBlock~.
|
2016-04-13 09:02:44 -05:00
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
2016-03-19 11:59:12 -05:00
|
|
|
fn foo_bar() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/// That one tests multiline ticks.
|
|
|
|
/// ```rust
|
|
|
|
/// foo_bar FOO_BAR
|
2016-03-28 14:23:21 -05:00
|
|
|
/// _foo bar_
|
2016-03-19 11:59:12 -05:00
|
|
|
/// ```
|
2016-07-08 11:18:45 -05:00
|
|
|
///
|
|
|
|
/// ~~~rust
|
|
|
|
/// foo_bar FOO_BAR
|
|
|
|
/// _foo bar_
|
|
|
|
/// ~~~
|
2016-04-13 09:02:44 -05:00
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
2016-07-08 11:18:45 -05:00
|
|
|
fn multiline_codeblock() {
|
2016-03-19 11:59:12 -05:00
|
|
|
}
|
|
|
|
|
2016-03-28 14:23:21 -05:00
|
|
|
/// This _is a test for
|
|
|
|
/// multiline
|
|
|
|
/// emphasis_.
|
2016-04-13 09:02:44 -05:00
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
2016-05-02 07:36:33 -05:00
|
|
|
fn test_emphasis() {
|
2016-03-28 14:23:21 -05:00
|
|
|
}
|
|
|
|
|
2016-04-04 13:18:17 -05:00
|
|
|
/// This tests units. See also #835.
|
|
|
|
/// kiB MiB GiB TiB PiB EiB
|
|
|
|
/// kib Mib Gib Tib Pib Eib
|
|
|
|
/// kB MB GB TB PB EB
|
|
|
|
/// kb Mb Gb Tb Pb Eb
|
|
|
|
/// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
|
|
|
|
/// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
|
|
|
|
/// 32kB 32MB 32GB 32TB 32PB 32EB
|
|
|
|
/// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
|
2016-06-08 15:00:42 -05:00
|
|
|
/// NaN
|
2016-04-13 09:02:44 -05:00
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
2016-05-02 07:36:33 -05:00
|
|
|
fn test_units() {
|
2016-04-13 09:02:44 -05:00
|
|
|
}
|
|
|
|
|
2020-09-10 10:47:07 -05:00
|
|
|
/// This tests allowed identifiers.
|
2021-02-25 04:25:22 -06:00
|
|
|
/// KiB MiB GiB TiB PiB EiB
|
2024-09-26 02:30:28 -05:00
|
|
|
/// MHz GHz THz
|
2024-07-25 11:29:17 -05:00
|
|
|
/// AccessKit
|
|
|
|
/// CoreFoundation CoreGraphics CoreText
|
|
|
|
/// Direct2D Direct3D DirectWrite DirectX
|
2020-09-10 10:47:07 -05:00
|
|
|
/// ECMAScript
|
2021-02-25 04:25:22 -06:00
|
|
|
/// GPLv2 GPLv3
|
|
|
|
/// GitHub GitLab
|
|
|
|
/// IPv4 IPv6
|
2024-07-25 11:29:17 -05:00
|
|
|
/// ClojureScript CoffeeScript JavaScript PostScript PureScript TypeScript
|
2023-07-02 07:35:19 -05:00
|
|
|
/// WebAssembly
|
2021-02-25 04:25:22 -06:00
|
|
|
/// NaN NaNs
|
2020-09-10 10:47:07 -05:00
|
|
|
/// OAuth GraphQL
|
2021-02-25 04:25:22 -06:00
|
|
|
/// OCaml
|
2024-07-25 11:29:17 -05:00
|
|
|
/// OpenAL OpenDNS OpenGL OpenMP OpenSSH OpenSSL OpenStreetMap OpenTelemetry
|
|
|
|
/// OpenType
|
|
|
|
/// WebGL WebGL2 WebGPU WebRTC WebSocket WebTransport
|
2021-02-25 04:25:22 -06:00
|
|
|
/// TensorFlow
|
|
|
|
/// TrueType
|
2024-07-25 11:29:17 -05:00
|
|
|
/// iOS macOS FreeBSD NetBSD OpenBSD
|
2020-09-10 10:47:07 -05:00
|
|
|
/// TeX LaTeX BibTeX BibLaTeX
|
2021-02-25 04:25:22 -06:00
|
|
|
/// MinGW
|
2020-09-10 10:47:07 -05:00
|
|
|
/// CamelCase (see also #2395)
|
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
|
|
|
fn test_allowed() {
|
|
|
|
}
|
|
|
|
|
2023-02-25 18:08:29 -06:00
|
|
|
/// This test has [a `link_with_underscores`][chunked-example] inside it. See #823.
|
2018-11-21 21:40:09 -06:00
|
|
|
/// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
|
2016-04-13 09:02:44 -05:00
|
|
|
/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
|
2023-02-25 18:08:29 -06:00
|
|
|
/// It can also be [inline_link2]. A link to [StackOverflow](https://stackoverflow.com) is also acceptable.
|
2016-04-01 10:24:55 -05:00
|
|
|
///
|
2016-04-11 16:22:30 -05:00
|
|
|
/// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
|
|
|
|
/// [inline_link]: https://foobar
|
2016-04-13 09:02:44 -05:00
|
|
|
/// [inline_link2]: https://foobar
|
2016-03-19 11:59:12 -05:00
|
|
|
/// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
|
|
|
|
/// `multiline_ticks` functions.
|
2016-04-11 16:22:30 -05:00
|
|
|
///
|
|
|
|
/// expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
|
|
|
|
/// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
|
2016-04-13 09:02:44 -05:00
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
2016-03-19 11:59:12 -05:00
|
|
|
fn main() {
|
|
|
|
foo_bar();
|
2016-07-08 11:18:45 -05:00
|
|
|
multiline_codeblock();
|
2016-03-28 14:23:21 -05:00
|
|
|
test_emphasis();
|
2016-04-04 13:18:17 -05:00
|
|
|
test_units();
|
2016-03-19 11:59:12 -05:00
|
|
|
}
|
2016-05-05 14:32:48 -05:00
|
|
|
|
2016-05-05 14:42:59 -05:00
|
|
|
/// ## CamelCaseThing
|
2019-01-30 19:15:29 -06:00
|
|
|
/// Talks about `CamelCaseThing`. Titles should be ignored; see issue #897.
|
2016-05-05 14:42:59 -05:00
|
|
|
///
|
|
|
|
/// # CamelCaseThing
|
|
|
|
///
|
|
|
|
/// Not a title #897 CamelCaseThing
|
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
|
|
|
fn issue897() {
|
|
|
|
}
|
|
|
|
|
2016-05-05 14:32:48 -05:00
|
|
|
/// I am confused by brackets? (`x_y`)
|
|
|
|
/// I am confused by brackets? (foo `x_y`)
|
|
|
|
/// I am confused by brackets? (`x_y` foo)
|
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
|
|
|
fn issue900() {
|
|
|
|
}
|
2016-05-05 14:34:42 -05:00
|
|
|
|
|
|
|
/// Diesel queries also have a similar problem to [Iterator][iterator], where
|
|
|
|
/// /// More talking
|
|
|
|
/// returning them from a function requires exposing the implementation of that
|
|
|
|
/// function. The [`helper_types`][helper_types] module exists to help with this,
|
|
|
|
/// but you might want to hide the return type or have it conditionally change.
|
|
|
|
/// Boxing can achieve both.
|
|
|
|
///
|
|
|
|
/// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
|
|
|
|
/// [helper_types]: ../helper_types/index.html
|
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
|
|
|
fn issue883() {
|
|
|
|
}
|
2016-05-26 15:53:38 -05:00
|
|
|
|
|
|
|
/// `foo_bar
|
|
|
|
/// baz_quz`
|
2016-05-27 20:18:52 -05:00
|
|
|
/// [foo
|
|
|
|
/// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
|
2016-05-26 15:53:38 -05:00
|
|
|
fn multiline() {
|
|
|
|
}
|
2016-07-08 11:18:45 -05:00
|
|
|
|
2019-01-30 19:15:29 -06:00
|
|
|
/** E.g., serialization of an empty list: FooBar
|
2016-07-08 11:18:45 -05:00
|
|
|
```
|
|
|
|
That's in a code block: `PackedNode`
|
|
|
|
```
|
|
|
|
|
|
|
|
And BarQuz too.
|
|
|
|
be_sure_we_got_to_the_end_of_it
|
|
|
|
*/
|
|
|
|
fn issue1073() {
|
|
|
|
}
|
|
|
|
|
2019-01-30 19:15:29 -06:00
|
|
|
/** E.g., serialization of an empty list: FooBar
|
2016-07-08 11:18:45 -05:00
|
|
|
```
|
|
|
|
That's in a code block: PackedNode
|
|
|
|
```
|
|
|
|
|
|
|
|
And BarQuz too.
|
|
|
|
be_sure_we_got_to_the_end_of_it
|
|
|
|
*/
|
|
|
|
fn issue1073_alt() {
|
|
|
|
}
|
|
|
|
|
2019-01-30 19:15:29 -06:00
|
|
|
/// Tests more than three quotes:
|
2016-07-08 11:18:45 -05:00
|
|
|
/// ````
|
|
|
|
/// DoNotWarn
|
|
|
|
/// ```
|
|
|
|
/// StillDont
|
|
|
|
/// ````
|
|
|
|
/// be_sure_we_got_to_the_end_of_it
|
|
|
|
fn four_quotes() {
|
|
|
|
}
|
2017-05-30 12:49:09 -05:00
|
|
|
|
2017-05-30 12:50:07 -05:00
|
|
|
#[cfg_attr(feature = "a", doc = " ```")]
|
|
|
|
#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
|
|
|
|
/// fn main() {
|
|
|
|
/// let s = "localhost:10000".to_string();
|
|
|
|
/// println!("{}", s);
|
|
|
|
/// }
|
|
|
|
/// ```
|
|
|
|
fn issue_1469() {}
|
2017-08-19 15:52:49 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a doc comment that should not be a list
|
|
|
|
*This would also be an error under a strict common mark interpretation
|
|
|
|
*/
|
|
|
|
fn issue_1920() {}
|
2017-06-18 16:00:14 -05:00
|
|
|
|
2018-12-07 04:48:06 -06:00
|
|
|
/// An iterator over mycrate::Collection's values.
|
|
|
|
/// It should not lint a `'static` lifetime in ticks.
|
|
|
|
fn issue_2210() {}
|
2018-12-07 15:38:45 -06:00
|
|
|
|
|
|
|
/// This should not cause the lint to trigger:
|
|
|
|
/// #REQ-data-family.lint_partof_exists
|
|
|
|
fn issue_2343() {}
|
2019-07-19 00:18:10 -05:00
|
|
|
|
|
|
|
/// This should not cause an ICE:
|
|
|
|
/// __|_ _|__||_|
|
|
|
|
fn pulldown_cmark_crash() {}
|
2021-04-08 10:50:13 -05:00
|
|
|
|
2021-10-07 04:21:30 -05:00
|
|
|
/// This should not lint
|
|
|
|
/// (regression test for #7758)
|
|
|
|
/// [plain text][path::to::item]
|
|
|
|
fn intra_doc_link() {}
|
|
|
|
|
2023-09-08 17:39:20 -05:00
|
|
|
/// Ignore escaped\_underscores
|
|
|
|
///
|
|
|
|
/// \\[
|
|
|
|
/// \\prod\_{x\\in X} p\_x
|
|
|
|
/// \\]
|
|
|
|
fn issue_2581() {}
|
|
|
|
|
|
|
|
/// Foo \[bar\] \[baz\] \[qux\]. DocMarkdownLint
|
|
|
|
fn lint_after_escaped_chars() {}
|
|
|
|
|
2021-08-25 04:21:39 -05:00
|
|
|
// issue #7033 - generic_const_exprs ICE
|
2021-04-08 10:50:13 -05:00
|
|
|
struct S<T, const N: usize>
|
|
|
|
where [(); N.checked_next_power_of_two().unwrap()]: {
|
|
|
|
arr: [T; N.checked_next_power_of_two().unwrap()],
|
|
|
|
n: usize,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T: Copy + Default, const N: usize> S<T, N>
|
|
|
|
where [(); N.checked_next_power_of_two().unwrap()]: {
|
|
|
|
fn new() -> Self {
|
|
|
|
Self {
|
|
|
|
arr: [T::default(); N.checked_next_power_of_two().unwrap()],
|
|
|
|
n: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-02 11:35:56 -05:00
|
|
|
|
|
|
|
/// this checks if the lowerCamelCase issue is fixed
|
|
|
|
fn issue_11568() {}
|
2023-12-16 07:12:50 -06:00
|
|
|
|
|
|
|
/// There is no try (do() or do_not()).
|
|
|
|
fn parenthesized_word() {}
|
2024-03-07 10:19:29 -06:00
|
|
|
|
|
|
|
/// ABes
|
|
|
|
/// OSes
|
|
|
|
/// UXes
|
|
|
|
fn plural_acronym_test() {}
|
2024-04-18 10:48:52 -05:00
|
|
|
|
|
|
|
extern {
|
|
|
|
/// foo()
|
|
|
|
fn in_extern();
|
|
|
|
}
|
2024-05-30 03:49:05 -05:00
|
|
|
|
|
|
|
/// https://github.com/rust-lang/rust-clippy/pull/12836
|
|
|
|
fn check_autofix_for_base_urls() {}
|