Open emilk opened 2 years ago
Tool lints are checked by their respective tools. You need to use cargo rustdoc -- -D rustdoc::missing_crate_level_docs
.
That shows a reason why cargo-lints
took a tool as the first argument, it would have been possible to expand it to cargo lints rustdoc
to support multiple tools (and maybe some cargo lints --all
option to rebuild with all the different tools).
Maybe cargo-cranky
should run both clippy and rustdoc by default? (EDIT: or based on detecting lint names from the config?) Unfortunately running rustdoc right now will generate docs if it is successful. There is an unstable --check
option that allows only running the lints.
There is also the problem that cargo rustdoc
cannot be run in a workspace:
cargo rustdoc -- -D rustdoc::missing_crate_level_docs
❯ cargo rustdoc -- -D rustdoc::missing_crate_level_docs
error: manifest path egui/Cargo.toml` is a virtual manifest, but this command requires running against an actual package in this workspace
cargo doc
is supposed to be used for workspaces, but then you cannot supply any lints:
❯ cargo doc -- -D rustdoc::missing_crate_level_docs -D rustdoc::unsafe_op_in_unsafe_fn
error: Found argument '-D' which wasn't expected, or isn't valid in this context
You can do something like RUSTDOCFLAGS=-Drustdoc::... cargo doc --workspace --no-deps
Another reason it'd be great to have all the intricacies handled by a tool like this 😁
Thanks @Nemo157, that works!
Currently if I put
"rustdoc::missing_crate_level_docs"
inwarn
inCranky.toml
it does nothing.…though honestly I don't understand the rustdoc lints.
cargo clippy -- -D rustdoc::missing_crate_level_docs
runs without warnings when there are missing crate level docs.