Closed
Description
What it does
Detects if
-then-panic!
that can be replaced with assert!
Categories (optional)
- Kind: style
What is the advantage of the recommended code over the original code
It is simpler
Drawbacks
None.
Example
if !sad_people.is_empty() {
panic!("there are sad people: {:?}", sad_people);
}
Could be written as:
assert!(sad_people.is_empty(), "there are sad people: {:?}", sad_people);
Lint name: manual_assert
or if_then_panic