#17519·cargo

`build.warnings` is not honored when using `cargo clippy --message-format=json`

Author: AlexTMjugadorCreated Sep 26, 2026Updated Oct 1, 2026
LabelsC-bugS-needs-designA-lints

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:

Screenshot of CI logs showing the described problem

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

  1. Clone https://github.com/ComunidadAylas/vorbis-rs at commit bd160df.
  2. Run CARGO_BUILD_WARNINGS=deny cargo clippy --message-format=json and watch it complete successfully.
  3. Run CARGO_BUILD_WARNINGS=deny cargo clippy and 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]