rust-lang / rust-lang/rust-clippy
Reeneable should_assert_eq lint
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Suggest replacing assert!(a == b) with assert_eq!(a, b). This is useful, because given the environment let a = 1, let b = 2, the displayed error changes between:
assert!(a == b)givesassertion failed: a == bassert_eq!(a, b)givesassertion_failed: left = 1, right = 2
The latter is vastly more helpful at diagnosing test failures. This lint was removed in #2156 because of RFC 2011. It's hard to follow the implementation progress of that RFC, but the issue hasn't been updated since early 2018, and I got the above assertion failures using a 2020-10-15 toolchain, so assert_eq! is still preferable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review RFC 2011 and the lint removal in #2156 first; the issue names no source file or test entry point. Completion means restoring a lint that recommends assert_eq!(a, b) for assert!(a == b), while confirming that the current RFC status supports the change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100