Closed
Description
What it does
Lint {debug_}assert{_eq,_ne}!
without a custom panic message. (inspired by this tweet)
Categories (optional)
- Kind: pedantic
What is the advantage of the recommended code over the original code
If the assertion fails, it might be easier to diagnose why.
Drawbacks
None.
Example
assert!(some_condition(foo));
debug_assert_eq(a, bar(b));
Could be written as:
assert!(some_condition(foo), "foo failed some condition: foo = {}", foo);
debug_assert_eq!(a, bar(b), "failed to find inverse of bar at {}", a);