Closed
Description
(Issue originally mentioned here)
Running cargo clippy
directly after cargo new
fails. This is maybe just my opinion, but it seems a little unfortunate that the default project template doesn't pass the linter.
It fails on assert_eq!(2 + 2, 4)
. I'm pretty sure that used to be fine. I would expect clippy to flag assert_eq!(4, 4)
, but not assert_eq!(2 + 2, 4)
.
Lint name: eq_op
I tried this code:
cargo +nightly-2021-01-23 new --lib foo
cd foo
cargo +nightly-2021-01-23 clippy --all-targets
(This is the default `src/lib.rs`, for reference)
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
I expected to see this happen:
no errors
Instead, this happened:
error: identical args used in this `assert_eq!` macro call
--> src\lib.rs:5:20
|
5 | assert_eq!(2 + 2, 4);
| ^^^^^^^^
|
= note: `#[deny(clippy::eq_op)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
error: aborting due to previous error
error: could not compile `foo`
Meta
clippy 0.1.51 (22ddcd1a 2021-01-22)
rustc 1.51.0-nightly (22ddcd1a1 2021-01-22)
binary: rustc
commit-hash: 22ddcd1a13082b7be0fc99b720677efd2b733816
commit-date: 2021-01-22
host: x86_64-pc-windows-msvc
release: 1.51.0-nightly
LLVM version: 11.0.1