Skip to content

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

Description

@AlexTMjugador

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: rustc lint configurationC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions