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


#1

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?


#2

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


#3

That worked perfectly; thanks!