Skip to content

cargo clippy and cargo check don't recognize source code changes without --release flag #9004

@felix-pb

Description

@felix-pb

Problem
cargo clippy and cargo check don't recognize source code changes unless they are run with the --release flag (see steps below). I expect that both commands should output the same thing (e.g. same lints for cargo clippy) with or without the --release flag when the source code changes.

Steps

  1. Run cargo new playground and cd into the project root.
  2. Run cargo clippy and the output is:
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
  1. Run cargo clippy --release and the output is:
Checking playground v0.1.0 (/Users/felix-pb/Desktop/playground)
Finished release [optimized] target(s) in 0.04s
  1. Add () on a new line after the print statement in src/main.rs.
  2. Run cargo clippy and the output is:
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
  1. Run cargo clippy --release and the output is:
Checking playground v0.1.0 (/Users/felix-pb/Desktop/playground)
warning: unneeded unit expression
 --> src/main.rs:3:5
  |
3 |     ()
  |     ^^ help: remove the final `()`
  |
  = note: `#[warn(clippy::unused_unit)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: 1 warning emitted

Notes

Output of cargo version: cargo 1.48.0 (65cbdd2 2020-10-14)

I'm using the current latest stable version of rustc.
Output of rustc --version: rustc 1.48.0 (7eac88abb 2020-11-16)
The problem is happening on both my personal and work laptops, both of which are macOS. My personal laptop is running macOS Big Sur (version 11.1) and my work laptop is running macOS Catalina (version 10.15.7). As far as I know, I haven't modified the default cargo settings on either of my laptops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions