Summary
rustdoc exposes additional configuration through CLI options, but they are not available through cargo doc. Passing extra args from cargo doc to rustdoc would expose them.
Motivation
- Fail on
rustdoclint warnings withcargo doc -- -D warnings
Guide-level explanation
Not sure what to write here
Reference-level explanation
In cargo doc subcommand (cargo/src/bin/cargo/commands/doc.rs at master · rust-lang/cargo · GitHub):
- add an arg that accept multiple values:
Arg::with_name("args").multiple(true) - pass the values to
compile_opts.target_rustdoc_args
Drawbacks
This exposes all rustdoc configuration, which adds complexity.
Rationale and alternatives
This is already possible with an environment variable: RUSTDOCFLAGS. This feature only brings parity to cargo doc as other cargo commands that accepts args: bench, run, rust, rustdoc, test.
It's nicer when running:
cargo clippy -- -D warnings
cargo doc -- -D warnings
// instead of
RUSTDOCFLAGS='-D warnings' cargo doc
Prior art
Not sure what to write here
Unresolved questions
Not sure what to write here
Future possibilities
Not sure what to write here