You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to work on this but I'm new to the codebase and might need some guidance.
Want to make sure I'm on the right track... this lint should implement the LateLintPasscheck_expr method right?
This seems like it would need a LateLintPass, since you need to know that the type of the expression being indexed is str (type information are only available in late lint passes), and check_expr sounds right to me. I would implement the check_expr method, check if the expression being checked is a method call to str::as_bytes and the receiver of the call is an index expression, with the indexed type being str. The clippy documentation (specifically "common tools") is probably helpful here. Good luck!
What it does
Suggests replacing slicing a
str
followed byas_bytes
with the opposite orderwith
Advantage
Drawbacks
Technically possible someone relied on it panicking, but find that unlikely.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: