Skip to content

Commit 956986a

Browse files
committed
trpl: add a small section outlining doctest configuration
1 parent fb27172 commit 956986a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/doc/trpl/documentation.md

+12
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,18 @@ You can control a few aspects of the HTML that `rustdoc` generates through the
590590

591591
This sets a few different options, with a logo, favicon, and a root URL.
592592

593+
### Configuring documentation tests
594+
595+
You can also configure the way that `rustdoc` tests your documentation examples
596+
through the `#![doc(test(..))]` attribute.
597+
598+
```rust
599+
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
600+
```
601+
602+
This allows unused variables within the examples, but will fail the test for any
603+
other lint warning thrown.
604+
593605
## Generation options
594606

595607
`rustdoc` also contains a few other options on the command line, for further customization:

0 commit comments

Comments
 (0)