summary refs log tree commit diff
path: root/tests/rustdoc-ui/lints
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-28 21:22:06 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-28 21:22:06 +0100
commit7cf3f8ba7a4a7c8b9dc7a44ccc1702fa7d0d2d1c (patch)
tree89d635525e73976b7332f48044d5933806d004f9 /tests/rustdoc-ui/lints
parentc1cfab230ebb2e9cb9f4ea69773fef956c706a71 (diff)
downloadrust-7cf3f8ba7a4a7c8b9dc7a44ccc1702fa7d0d2d1c.tar.gz
rust-7cf3f8ba7a4a7c8b9dc7a44ccc1702fa7d0d2d1c.zip
Do not emit `missing_doc_code_examples` rustdoc lint on module and a few other items
Diffstat (limited to 'tests/rustdoc-ui/lints')
-rw-r--r--tests/rustdoc-ui/lints/check.rs1
-rw-r--r--tests/rustdoc-ui/lints/check.stderr28
-rw-r--r--tests/rustdoc-ui/lints/doc-without-codeblock.rs3
-rw-r--r--tests/rustdoc-ui/lints/doc-without-codeblock.stderr26
-rw-r--r--tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs2
-rw-r--r--tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr14
6 files changed, 19 insertions, 55 deletions
diff --git a/tests/rustdoc-ui/lints/check.rs b/tests/rustdoc-ui/lints/check.rs
index 391ba517077..058c5d6c468 100644
--- a/tests/rustdoc-ui/lints/check.rs
+++ b/tests/rustdoc-ui/lints/check.rs
@@ -4,7 +4,6 @@
 
 #![feature(rustdoc_missing_doc_code_examples)]
 //~^ WARN
-//~^^ WARN
 
 #![warn(missing_docs)]
 #![warn(rustdoc::missing_doc_code_examples)]
diff --git a/tests/rustdoc-ui/lints/check.stderr b/tests/rustdoc-ui/lints/check.stderr
index acdb8128443..f1f36e8830d 100644
--- a/tests/rustdoc-ui/lints/check.stderr
+++ b/tests/rustdoc-ui/lints/check.stderr
@@ -4,19 +4,20 @@ warning: missing documentation for the crate
 LL | / #![feature(rustdoc_missing_doc_code_examples)]
 LL | |
 LL | |
+LL | | #![warn(missing_docs)]
 ...  |
 LL | |
 LL | | pub fn foo() {}
    | |_______________^
    |
 note: the lint level is defined here
-  --> $DIR/check.rs:9:9
+  --> $DIR/check.rs:8:9
    |
 LL | #![warn(missing_docs)]
    |         ^^^^^^^^^^^^
 
 warning: missing documentation for a function
-  --> $DIR/check.rs:13:1
+  --> $DIR/check.rs:12:1
    |
 LL | pub fn foo() {}
    | ^^^^^^^^^^^^
@@ -26,34 +27,23 @@ warning: no documentation found for this crate's top-level module
    = help: The following guide may be of use:
            https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html
 note: the lint level is defined here
-  --> $DIR/check.rs:11:9
+  --> $DIR/check.rs:10:9
    |
 LL | #![warn(rustdoc::all)]
    |         ^^^^^^^^^^^^
    = note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]`
 
 warning: missing code example in this documentation
-  --> $DIR/check.rs:5:1
+  --> $DIR/check.rs:12:1
    |
-LL | / #![feature(rustdoc_missing_doc_code_examples)]
-LL | |
-LL | |
-...  |
-LL | |
-LL | | pub fn foo() {}
-   | |_______________^
+LL | pub fn foo() {}
+   | ^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
-  --> $DIR/check.rs:10:9
+  --> $DIR/check.rs:9:9
    |
 LL | #![warn(rustdoc::missing_doc_code_examples)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: missing code example in this documentation
-  --> $DIR/check.rs:13:1
-   |
-LL | pub fn foo() {}
-   | ^^^^^^^^^^^^^^^
-
-warning: 5 warnings emitted
+warning: 4 warnings emitted
 
diff --git a/tests/rustdoc-ui/lints/doc-without-codeblock.rs b/tests/rustdoc-ui/lints/doc-without-codeblock.rs
index 86d7c83d335..ccb241d4037 100644
--- a/tests/rustdoc-ui/lints/doc-without-codeblock.rs
+++ b/tests/rustdoc-ui/lints/doc-without-codeblock.rs
@@ -1,4 +1,4 @@
-#![feature(rustdoc_missing_doc_code_examples)] //~ ERROR missing code example in this documentation
+#![feature(rustdoc_missing_doc_code_examples)]
 #![deny(rustdoc::missing_doc_code_examples)]
 
 /// Some docs.
@@ -6,7 +6,6 @@
 pub struct Foo;
 
 /// And then, the princess died.
-//~^ ERROR missing code example in this documentation
 pub mod foo {
     /// Or maybe not because she saved herself!
     //~^ ERROR missing code example in this documentation
diff --git a/tests/rustdoc-ui/lints/doc-without-codeblock.stderr b/tests/rustdoc-ui/lints/doc-without-codeblock.stderr
index ebf2a2d54f7..d230f160693 100644
--- a/tests/rustdoc-ui/lints/doc-without-codeblock.stderr
+++ b/tests/rustdoc-ui/lints/doc-without-codeblock.stderr
@@ -1,14 +1,8 @@
 error: missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:1:1
+  --> $DIR/doc-without-codeblock.rs:10:5
    |
-LL | / #![feature(rustdoc_missing_doc_code_examples)]
-LL | | #![deny(rustdoc::missing_doc_code_examples)]
-LL | |
-LL | | /// Some docs.
-...  |
-LL | |     }
-LL | | }
-   | |_^
+LL |     /// Or maybe not because she saved herself!
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/doc-without-codeblock.rs:2:9
@@ -17,22 +11,10 @@ LL | #![deny(rustdoc::missing_doc_code_examples)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:8:1
-   |
-LL | /// And then, the princess died.
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:11:5
-   |
-LL |     /// Or maybe not because she saved herself!
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing code example in this documentation
   --> $DIR/doc-without-codeblock.rs:4:1
    |
 LL | /// Some docs.
    | ^^^^^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs
index 40f35728d79..8e5c31d50ed 100644
--- a/tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs
+++ b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs
@@ -17,7 +17,7 @@ pub fn test() {
 }
 
 #[allow(missing_docs)]
-pub mod module1 { //~ ERROR
+pub mod module1 {
 }
 
 #[allow(rustdoc::missing_doc_code_examples)]
diff --git a/tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr
index f9331250154..22533b9816a 100644
--- a/tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr
+++ b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr
@@ -1,8 +1,8 @@
 error: missing code example in this documentation
-  --> $DIR/lint-missing-doc-code-example.rs:20:1
+  --> $DIR/lint-missing-doc-code-example.rs:38:3
    |
-LL | pub mod module1 {
-   | ^^^^^^^^^^^^^^^
+LL |   /// doc
+   |   ^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/lint-missing-doc-code-example.rs:3:9
@@ -11,12 +11,6 @@ LL | #![deny(rustdoc::missing_doc_code_examples)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing code example in this documentation
-  --> $DIR/lint-missing-doc-code-example.rs:38:3
-   |
-LL |   /// doc
-   |   ^^^^^^^
-
-error: missing code example in this documentation
   --> $DIR/lint-missing-doc-code-example.rs:50:1
    |
 LL | /// Doc
@@ -34,5 +28,5 @@ error: missing code example in this documentation
 LL | /// Doc
    | ^^^^^^^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors