RS.CLIPPY.DOC_INCLUDE_WITHOUT_CFG
Check if files included in documentation are behind `cfg(doc)`
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: doc_include_without_cfg. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks if included files in doc comments are included only for cfg(doc).
Why restrict this?
These files are not useful for compilation but will still be included. Also, if any of these non-source code file is updated, it will trigger a recompilation.
Known problems
Excluding this will currently result in the file being left out if the item's docs are inlined from another crate. This may be fixed in a future version of rustdoc.
Example
#![doc = include_str!("some_file.md")]
Use instead:
#![cfg_attr(doc, doc = include_str!("some_file.md"))]