Strenghten tests for missing_doc_code_examples lint

This commit is contained in:
Guillaume Gomez 2020-08-21 18:05:51 +02:00
parent dadde88eba
commit 7a05f13aed
2 changed files with 54 additions and 5 deletions

View file

@ -38,3 +38,34 @@ pub mod module3 {
//~^ ERROR //~^ ERROR
pub fn test() {} pub fn test() {}
} }
/// Doc, but no code example and it's fine!
pub const Const: u32 = 0;
/// Doc, but no code example and it's fine!
pub static Static: u32 = 0;
/// Doc, but no code example and it's fine!
pub type Type = u32;
/// Doc
//~^ ERROR
pub struct Struct {
/// Doc, but no code example and it's fine!
pub field: u32,
}
/// Doc
//~^ ERROR
pub enum Enum {
/// Doc, but no code example and it's fine!
X,
}
/// Doc
//~^ ERROR
#[repr(C)]
union Union {
/// Doc, but no code example and it's fine!
a: i32,
/// Doc, but no code example and it's fine!
b: f32,
}

View file

@ -1,9 +1,8 @@
error: missing code example in this documentation error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:19:1 --> $DIR/lint-missing-doc-code-example.rs:49:1
| |
LL | / mod module1 { LL | /// Doc
LL | | } | ^^^^^^^
| |_^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-missing-doc-code-example.rs:2:9 --> $DIR/lint-missing-doc-code-example.rs:2:9
@ -11,11 +10,30 @@ note: the lint level is defined here
LL | #![deny(missing_doc_code_examples)] LL | #![deny(missing_doc_code_examples)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:63:1
|
LL | /// Doc
| ^^^^^^^
error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:56:1
|
LL | /// Doc
| ^^^^^^^
error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:19:1
|
LL | / mod module1 {
LL | | }
| |_^
error: missing code example in this documentation error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:37:3 --> $DIR/lint-missing-doc-code-example.rs:37:3
| |
LL | /// doc LL | /// doc
| ^^^^^^^ | ^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 5 previous errors