rust-clippy
rust-clippy copied to clipboard
Reeneable should_assert_eq lint
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.