Skip to content

Running cargo clippy --fix followed by cargo clippy -- -Dwarnings doesn't fail on tripped warnings during the fix stage #17444

Description

@ReinierMaas

Summary

XRef: channable/opsqueue#149

Known workaround use a different CARGO_TARGET_DIR:

CARGO_TARGET_DIR=target/clippy-fix cargo clippy --fix

Let me know if you need more information!

Reproducer

Code:

<code>

Current output (--fix incantation followed by no --fix incantation succeeds):

cargo clippy --no-deps --all-targets --fix --allow-dirty --allow-staged -- -Dwarnings
    Updating crates.io index
   Compiling opsqueue v0.36.0 (/home/runner/work/opsqueue/opsqueue/opsqueue)
warning: multiple versions for dependency `tokio-tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions
  = note: requested on the command line with `-D clippy::multiple-crate-versions`

warning: multiple versions for dependency `tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions

warning: `opsqueue` (lib test) generated 2 warnings
warning: `opsqueue` (lib) generated 2 warnings (2 duplicates)
    Checking opsqueue_python v0.36.0 (/home/runner/work/opsqueue/opsqueue/libs/opsqueue_python)
warning: `opsqueue_python` (lib test) generated 2 warnings (2 duplicates)
warning: `opsqueue` (bin "opsqueue") generated 2 warnings (2 duplicates)
warning: `opsqueue` (bin "opsqueue" test) generated 2 warnings (2 duplicates)
warning: `opsqueue_python` (lib) generated 2 warnings (2 duplicates)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 12.40s
cargo clippy --no-deps --all-targets -- -Dwarnings
warning: multiple versions for dependency `tokio-tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions
  = note: requested on the command line with `-D clippy::multiple-crate-versions`

warning: multiple versions for dependency `tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions

warning: `opsqueue` (lib) generated 2 warnings
warning: `opsqueue_python` (lib test) generated 2 warnings (2 duplicates)
warning: `opsqueue_python` (lib) generated 2 warnings (2 duplicates)
warning: `opsqueue` (bin "opsqueue" test) generated 2 warnings (2 duplicates)
warning: `opsqueue` (lib test) generated 2 warnings (2 duplicates)
warning: `opsqueue` (bin "opsqueue") generated 2 warnings (2 duplicates)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s

Desired output (cargo clean executed in between, no --fix incantation prefixed):

cargo clippy --no-deps --all-targets -- -Dwarnings
    Updating crates.io index
   Compiling opsqueue v0.36.0 (/home/runner/work/opsqueue/opsqueue/opsqueue)
error: multiple versions for dependency `tokio-tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions
  = note: requested on the command line with `-D clippy::multiple-crate-versions`

error: multiple versions for dependency `tungstenite`: 0.29.0, 0.30.0
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#multiple_crate_versions

error: could not compile `opsqueue` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `opsqueue` (lib test) due to 2 previous errors
error: recipe `clippy` failed on line 97 with exit code 101
Error: Process completed with exit code 101.

Version

$ rustc --version
rustc 1.96.1 (31fca3adb 2026-06-26)
$ cargo --version
cargo 1.96.1 (356927216 2026-06-26)
$ cargo-clippy --version
clippy 0.1.96 (31fca3adb2 2026-06-26)



$ rustc -Vv
rustc 1.96.1 (31fca3adb 2026-06-26)
binary: rustc
commit-hash: 31fca3adb283cc9dfd56b49cdee9a96eb9c96ffd
commit-date: 2026-06-26
host: x86_64-unknown-linux-gnu
release: 1.96.1
LLVM version: 22.1.2

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions