Skip to content

Commit 26479c4

Browse files
Add test for docs without examples
1 parent 2def81a commit 26479c4

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![deny(missing_doc_code_examples)]
12+
13+
/// Some docs.
14+
pub struct Foo;
15+
16+
/// And then, the princess died.
17+
pub mod foo {
18+
/// Or maybe not because she saved herself!
19+
pub fn bar() {}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: Missing code example in this documentation
2+
|
3+
note: lint level defined here
4+
--> $DIR/doc-without-codeblock.rs:11:9
5+
|
6+
LL | #![deny(missing_doc_code_examples)]
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
8+
9+
error: Missing code example in this documentation
10+
--> $DIR/doc-without-codeblock.rs:13:1
11+
|
12+
LL | /// Some docs.
13+
| ^^^^^^^^^^^^^^
14+
15+
error: Missing code example in this documentation
16+
--> $DIR/doc-without-codeblock.rs:16:1
17+
|
18+
LL | /// And then, the princess died.
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
21+
error: Missing code example in this documentation
22+
--> $DIR/doc-without-codeblock.rs:18:5
23+
|
24+
LL | /// Or maybe not because she saved herself!
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+

0 commit comments

Comments
 (0)