summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /src/tools/clippy/tests/ui/doc
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/doc')
-rw-r--r--src/tools/clippy/tests/ui/doc/doc-fixable.fixed1
-rw-r--r--src/tools/clippy/tests/ui/doc/doc-fixable.rs1
-rw-r--r--src/tools/clippy/tests/ui/doc/doc-fixable.stderr32
-rw-r--r--src/tools/clippy/tests/ui/doc/needless_doctest_main.rs20
4 files changed, 38 insertions, 16 deletions
diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.fixed b/src/tools/clippy/tests/ui/doc/doc-fixable.fixed
index d3aa2816c..14444df4c 100644
--- a/src/tools/clippy/tests/ui/doc/doc-fixable.fixed
+++ b/src/tools/clippy/tests/ui/doc/doc-fixable.fixed
@@ -60,6 +60,7 @@ fn test_units() {
/// GitHub GitLab
/// IPv4 IPv6
/// ClojureScript CoffeeScript JavaScript PureScript TypeScript
+/// WebAssembly
/// NaN NaNs
/// OAuth GraphQL
/// OCaml
diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.rs b/src/tools/clippy/tests/ui/doc/doc-fixable.rs
index d1e7d8017..542d33b13 100644
--- a/src/tools/clippy/tests/ui/doc/doc-fixable.rs
+++ b/src/tools/clippy/tests/ui/doc/doc-fixable.rs
@@ -60,6 +60,7 @@ fn test_units() {
/// GitHub GitLab
/// IPv4 IPv6
/// ClojureScript CoffeeScript JavaScript PureScript TypeScript
+/// WebAssembly
/// NaN NaNs
/// OAuth GraphQL
/// OCaml
diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
index 6c67c903c..94ef43afc 100644
--- a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
+++ b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
@@ -132,7 +132,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:74:5
+ --> $DIR/doc-fixable.rs:75:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -143,7 +143,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:91:5
+ --> $DIR/doc-fixable.rs:92:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -154,7 +154,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:99:8
+ --> $DIR/doc-fixable.rs:100:8
|
LL | /// ## CamelCaseThing
| ^^^^^^^^^^^^^^
@@ -165,7 +165,7 @@ LL | /// ## `CamelCaseThing`
| ~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:102:7
+ --> $DIR/doc-fixable.rs:103:7
|
LL | /// # CamelCaseThing
| ^^^^^^^^^^^^^^
@@ -176,7 +176,7 @@ LL | /// # `CamelCaseThing`
| ~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:104:22
+ --> $DIR/doc-fixable.rs:105:22
|
LL | /// Not a title #897 CamelCaseThing
| ^^^^^^^^^^^^^^
@@ -187,7 +187,7 @@ LL | /// Not a title #897 `CamelCaseThing`
| ~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:105:5
+ --> $DIR/doc-fixable.rs:106:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -198,7 +198,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:112:5
+ --> $DIR/doc-fixable.rs:113:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -209,7 +209,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:125:5
+ --> $DIR/doc-fixable.rs:126:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -220,7 +220,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:136:43
+ --> $DIR/doc-fixable.rs:137:43
|
LL | /** E.g., serialization of an empty list: FooBar
| ^^^^^^
@@ -231,7 +231,7 @@ LL | /** E.g., serialization of an empty list: `FooBar`
| ~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:141:5
+ --> $DIR/doc-fixable.rs:142:5
|
LL | And BarQuz too.
| ^^^^^^
@@ -242,7 +242,7 @@ LL | And `BarQuz` too.
| ~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:142:1
+ --> $DIR/doc-fixable.rs:143:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -253,7 +253,7 @@ LL | `be_sure_we_got_to_the_end_of_it`
|
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:147:43
+ --> $DIR/doc-fixable.rs:148:43
|
LL | /** E.g., serialization of an empty list: FooBar
| ^^^^^^
@@ -264,7 +264,7 @@ LL | /** E.g., serialization of an empty list: `FooBar`
| ~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:152:5
+ --> $DIR/doc-fixable.rs:153:5
|
LL | And BarQuz too.
| ^^^^^^
@@ -275,7 +275,7 @@ LL | And `BarQuz` too.
| ~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:153:1
+ --> $DIR/doc-fixable.rs:154:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -286,7 +286,7 @@ LL | `be_sure_we_got_to_the_end_of_it`
|
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:164:5
+ --> $DIR/doc-fixable.rs:165:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -297,7 +297,7 @@ LL | /// `be_sure_we_got_to_the_end_of_it`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: item in documentation is missing backticks
- --> $DIR/doc-fixable.rs:183:22
+ --> $DIR/doc-fixable.rs:184:22
|
LL | /// An iterator over mycrate::Collection's values.
| ^^^^^^^^^^^^^^^^^^^
diff --git a/src/tools/clippy/tests/ui/doc/needless_doctest_main.rs b/src/tools/clippy/tests/ui/doc/needless_doctest_main.rs
new file mode 100644
index 000000000..f1a2c0575
--- /dev/null
+++ b/src/tools/clippy/tests/ui/doc/needless_doctest_main.rs
@@ -0,0 +1,20 @@
+#![warn(clippy::needless_doctest_main)]
+//! issue 10491:
+//! ```rust,no_test
+//! use std::collections::HashMap;
+//!
+//! fn main() {
+//! let mut m = HashMap::new();
+//! m.insert(1u32, 2u32);
+//! }
+//! ```
+
+/// some description here
+/// ```rust,no_test
+/// fn main() {
+/// foo()
+/// }
+/// ```
+fn foo() {}
+
+fn main() {}