-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint groupT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
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);
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint groupT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy