`build.warnings` is not honored when using `cargo clippy --message-format=json`
Problem
While taking care of miscellaneous maintenance tasks in my vorbis-rs project, I noticed that using CARGO_BUILD_WARNINGS=deny cargo clippy --message-format=json does not cause Cargo to error out on Clippy warnings as expected:
Omitting the --message-format=json parameter causes Clippy to error out as expected. Using the older -D warnings switch instead of CARGO_BUILD_WARNINGS=deny also causes Clippy to error out.
Link to the CI run shown above: https://github.com/ComunidadAylas/vorbis-rs/actions/runs/36269077411/job/108479444526#step:6:118
Steps
- Clone https://github.com/ComunidadAylas/vorbis-rs at commit
bd160df. - Run
CARGO_BUILD_WARNINGS=deny cargo clippy --message-format=jsonand watch it complete successfully. - Run
CARGO_BUILD_WARNINGS=deny cargo clippyand watch it fail as expected.
Possible Solution(s)
No response
Notes
This behavior can greatly limit the usefulness of the build.warnings setting when Clippy is used with the --message-format=json parameter. In my case, that parameter is required to convert Clippy's diagnostic output to SARIF via clippy-sarif for better integration with GitHub's code analysis tools and UI.
Version
cargo 1.100.0-nightly (3d7cf6e93 2026-09-25)
release: 1.100.0-nightly
commit-hash: 3d7cf6e937d6127d0f49881bf689c560b36d35c4
commit-date: 2026-09-25
host: x86_64-unknown-linux-gnu
libgit2: 1.9.6 (sys:0.21.0 vendored)
libcurl: 8.21.0-DEV (sys:0.4.90+curl-8.21.0 vendored ssl:OpenSSL/3.6.3)
ssl: OpenSSL 3.6.3 9 Jun 2026
os: Debian n/a (forky) [64-bit]Source: rust-lang/cargo