-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
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
- Run
cargo new playgroundandcdinto the project root. - Run
cargo clippyand the output is:
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
- Run
cargo clippy --releaseand the output is:
Checking playground v0.1.0 (/Users/felix-pb/Desktop/playground)
Finished release [optimized] target(s) in 0.04s
- Add
()on a new line after the print statement insrc/main.rs. - Run
cargo clippyand the output is:
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
- Run
cargo clippy --releaseand 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.