Skip to content

Commit 6d3b780

Browse files
Add more tests for rustdoc missing_doc_code_examples lint
1 parent 74c51ce commit 6d3b780

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ impl Clone for Struct {
7878
}
7979
}
8080

81-
81+
impl Struct { // No doc or code example and it's fine!
82+
pub fn bar() {}
83+
//~^ ERROR missing code example in this documentation
84+
//~| ERROR missing documentation for an associated function
85+
}
8286

8387
/// doc
8488
///

tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
error: missing documentation for an associated function
2+
--> $DIR/lint-missing-doc-code-example.rs:82:5
3+
|
4+
LL | pub fn bar() {}
5+
| ^^^^^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/lint-missing-doc-code-example.rs:2:9
9+
|
10+
LL | #![deny(missing_docs)]
11+
| ^^^^^^^^^^^^
12+
113
error: missing code example in this documentation
214
--> $DIR/lint-missing-doc-code-example.rs:38:3
315
|
@@ -28,5 +40,11 @@ error: missing code example in this documentation
2840
LL | /// Doc
2941
| ^^^^^^^
3042

31-
error: aborting due to 4 previous errors
43+
error: missing code example in this documentation
44+
--> $DIR/lint-missing-doc-code-example.rs:82:5
45+
|
46+
LL | pub fn bar() {}
47+
| ^^^^^^^^^^^^^^^
48+
49+
error: aborting due to 6 previous errors
3250

0 commit comments

Comments
 (0)