cargo check --all-targets which checks everything in-tree (excluding doctests but, AIUI, including
#[test] and cargo "integration" tests).
cargo doc is more limited. Limitations seem to me to include:
- No ability to document test items at all. This could be a hindrance when a package has sophisticated test suite with infrastructure which is all
- No command line option like
--all-targetsto bring together all the things that can be documented.
The way to get dev-dependencies documented is to sayThere is no way to document dev-dependencies?
--examples. This is rather obscure. It also has a downside: examples often have short name-clashy kinds of names, and this interacts badly with the cargo output file name clash problem (https://github.com/rust-lang/cargo/issues/6313 etc).
I suggest the following approach:
- Introduce a new
--document-dev-dependenciesoption (name TBD) which adds the dev-dependencies to the things to be documented. This can be stable as soon as it is implemented, and provides a way to get the dev-dependencies documented without being afflicted by the cargo output dupes problem.
- Introduce a new unstable option
--all-targetswhich documents everything that can be documented.
- Change cargo's output paths for examples, placing all examples into a path derived from the containing package and the path within the module.
--testswhich documents (only, all) tests. For cargo "integration" tests, the output filename should be very qualified, like for examples.
- When all of the above is done,
--all-targetsactually does document all tagets and can be stabilised.