What it does
Detect match statements of form str_variable.to_lowercase() with non-lowercase string literals as match arms. Should also apply to to_ascii_lowercase, to_uppercase, and to_ascii_uppercase.
Categories (optional)
- Kind:
clippy::correctness
The flagged match arm in the original code wouldn't ever be triggered, which is likely a bug in the program.
Drawbacks
None.
Example
match &*kind.to_ascii_lowercase() {
"foo" => {},
"Bar" => {},
_ => {},
}
Should be written as:
match &*kind.to_ascii_lowercase() {
"foo" => {},
"bar" => {},
_ => {},
}