We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect assert!(a == b) and assert!(a != b) and suggest using assert_eq! or assert_ne! respectively.
assert!(a == b)
assert!(a != b)
assert_eq!
assert_ne!
Should probably apply to debug_assert! as well.
debug_assert!
No response
assert!(fib(6) == 8);
Could be written as:
assert_eq!(fib(6), 8);
The text was updated successfully, but these errors were encountered:
I wonder if we should extend the bool_assert_comparison lint.
The description actually matches what is being proposed:
This lint warns about boolean comparisons in assert-like macros.
Sorry, something went wrong.
@rustbot claim
assert!(a==b)
assert_eq!(a,b)
bool_assert_comparison
nyurik
Successfully merging a pull request may close this issue.
What it does
Detect
assert!(a == b)
andassert!(a != b)
and suggest usingassert_eq!
orassert_ne!
respectively.Should probably apply to
debug_assert!
as well.Advantage
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: