Render documentation on code behind #[cfg(test)]?

I've got some doc comments on code which is behind a #[cfg(test)] directive. Thus, when I run cargo rustdoc**, the documentation on this code isn't rendered. Is there a way I can fix that?

** OK, actually it's cargo rustdoc -- --no-defaults --passes collapse-docs --passes unindent-comments --passes strip-priv-imports, but who's counting?

1 Like

You can add --cfg test attribute to cargo doc.

That worked perfectly; thanks!