rustrust-cargorustdoc

How can I make the 'rustdoc::broken_intra_doc_links' lint an error from the command line


Rustdoc has a lint called rustdoc::broken_intra_doc_links for checking doc status. I would like to make this lint into an error via command line flags. Most rust lints can be configured via -D flags but I can't figure out how to do it for rustdoc, even when invoking it explicitly on the command line. I tried for example

cargo rustdoc -p mycrate -- -D "rustdoc::broken_intra_doc_links"

but this just gives me the error error[E0602]: unknown lint: 'broken_intra_doc_links'

I am aware that I can put #![deny(rustdoc::broken_intra_doc_links)] into the code to flag this, I don't wish to do this.


Solution

  • Typically, lints on the command line use dashes, but they use underscores when written as part of the file, whether for rustdoc, clippy, or otherwise. So this should work, and something similar appears to work for me on the command line:

    $ cargo rustdoc -p mycrate -- -D rustdoc::broken-intra-doc-links