rustrust-cargorustdoc

How can I run the rustdoc lints on every crate in my workspace?


Rustdoc offers some pretty useful lints for documentation. I'd like to check these lints as part of continuous integration for all of the crates in my Cargo workspace.

Unfortunately, I've not been able to find a way to run these lints for all of my crates. You can do e.g.

cargo rustdoc -p crate -- -D rustdoc::broken-intra-doc-links

to run on a specific crate, but there's no --workspace flag on cargo rustdoc. Obviously I could do some hacky thing with xargs here, but that's pretty slow & annoying. Is there a supported way to run this check?


Solution

  • You can use RUSTDOCFLAGS and cargo doc:

    RUSTDOCFLAGS="-D rustdoc::broken-intra-doc-links" cargo doc