Home > front end >  Make `cargo doc` fail if there are warnings
Make `cargo doc` fail if there are warnings

Time:10-07

I'd like to test in CI that cargo doc succeeds without any warnings. Is there any way to get cargo doc to exit with a non-zero exit code if there are warnings?

CodePudding user response:

This should be helpful. Basically you can pass additional flags to the compiler by setting RUSTFLAGS env variable. So to deny all warnings (for any build type) is as simple as setting RUSTFLAGS="-D warnings".

EDIT. To deny warnings in the generated documentation those flags must be set by RUSTDOCFLAGS env variable instead.

  • Related