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
Suggests replacing assert!(matches!(a, b)) and assert!(a == b); with assert_eq!(a, b) if PartialEq and Debug is implemented
assert!(matches!(a, b))
assert!(a == b);
assert_eq!(a, b)
PartialEq
Debug
Suppose ...
#[derive(PartialEq, Debug)] enum Enum { A, B, } let value = Enum::A;
Then the following code
assert!(matches!(value, Enum::A)); // or assert!(value == Enum::A);
could be written as:
assert_eq!(value, Enum::A);
Also similar case possible for assert_ne!, debug_assert_eq!, debug_assert_ne!
assert_ne!
debug_assert_eq!
debug_assert_ne!
The text was updated successfully, but these errors were encountered:
When dealing with eg very long strings I sometimes prefer assert! specifically so I don't have to see them
assert!
Sorry, something went wrong.
Related: #6637
No branches or pull requests
What it does
Suggests replacing
assert!(matches!(a, b))
andassert!(a == b);
withassert_eq!(a, b)
ifPartialEq
andDebug
is implementedAdvantage
Example
Suppose ...
Then the following code
could be written as:
Also similar case possible for
assert_ne!
,debug_assert_eq!
,debug_assert_ne!
The text was updated successfully, but these errors were encountered: