In a Rust project there is a module with utilities to support testing, packed in a module test_utils
:
#[cfg(test)]
pub mod test_utils;
Is there a way to make cargo doc
generate also the documentation for test_utils
module and the things inside?
There are probably multiple ways of generating documentation for tests, but I think the easier approach is to generate the documentation with cargo rustdoc
and pass the --cfg test
flag through:
cargo rustdoc -- --cfg test