-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
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
Enable lint clippy::string_slice
#1056
Comments
Sounds like a good plan. Just to clarify, this entails actually fixing those places identified by the lint, right? |
Enabling the lint and fixing the places yeah. But also finding cases where this lint is not noticing this bad behavior to report this and improve the lint (for us and everyone else). Created rust-lang/rust-clippy#12708 for the missing hint on Cow, which ratatui uses heavily. Not sure whether there are other false negatives of the lint. |
Problem
Slicing of strings can panic on multi width characters. See for example #1032
Solution
Enable the following lint to find all cases where this might happen (now and in the future).
https://rust-lang.github.io/rust-clippy/master/index.html#string_slice
This lint does not catch #1032 for example. But it catches other places. It is probably a good idea to suggest false negatives like #1032 to clippy to be integrated in this lint.
The text was updated successfully, but these errors were encountered: