Skip to content

Commit 5ae1937

Browse files
committed
trpl: add a small section outlining doctest configuration
1 parent 8e23e2f commit 5ae1937

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
@@ -620,6 +620,18 @@ You can control a few aspects of the HTML that `rustdoc` generates through the
620620

621621
This sets a few different options, with a logo, favicon, and a root URL.
622622

623+
### Configuring documentation tests
624+
625+
You can also configure the way that `rustdoc` tests your documentation examples
626+
through the `#![doc(test(..))]` attribute.
627+
628+
```rust
629+
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
630+
```
631+
632+
This allows unused variables within the examples, but will fail the test for any
633+
other lint warning thrown.
634+
623635
## Generation options
624636

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

0 commit comments

Comments
 (0)