You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ndmitchell opened this issue
Jan 25, 2021
· 1 comment
Labels
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-macrosType: Issues with macros and macro expansion
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) gives assertion failed: a == b
assert_eq!(a, b) gives assertion_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.
The text was updated successfully, but these errors were encountered:
camsteffen
added
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-macros
Type: Issues with macros and macro expansion
labels
Jan 26, 2021
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-macrosType: Issues with macros and macro expansion
Suggest replacing
assert!(a == b)
withassert_eq!(a, b)
. This is useful, because given the environmentlet a = 1
,let b = 2
, the displayed error changes between:assert!(a == b)
givesassertion failed: a == b
assert_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.The text was updated successfully, but these errors were encountered: