Closed
Description
I tried this code:
#![warn(private_doc_tests)]
mod foo {
/// private doc test
///
/// ```ignore
/// assert!(false);
/// ```
fn bar() {}
}
I expected to see this happen: No warning for the given code block.
Instead, this happened: Warning appears for the given code block.
warning: documentation test in private item
--> src/lib.rs:4:5
|
4 | / /// private doc test
5 | | ///
6 | | /// ```
7 | | /// assert!(false);
8 | | /// ```
| |___________^
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(private_doc_tests)]
| ^^^^^^^^^^^^^^^^^
As it is, I don't see a way to include a rust-highlighted code block with this lint. It is not uncommon to have sample code that is not intended to be tested, or even pseudo-code that you want highlighted, like this:
rust/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Lines 490 to 499 in 9fe551a
It would be nice to have some way to make the lint not fire, but still get rust syntax highlighting. ignore
seems like the first choice I would make, though I guess there could be other options.
Meta
rustdoc 1.48.0-nightly (c59199efc 2020-09-04)