Skip to content
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

Improve indexing_slicing help message #2866

Open
shnewto opened this issue Jun 21, 2018 · 0 comments
Open

Improve indexing_slicing help message #2866

shnewto opened this issue Jun 21, 2018 · 0 comments
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@shnewto
Copy link
Contributor

shnewto commented Jun 21, 2018

The help message reported by the indexing_slicing lint could be improved to be more specific. Currently its reports are relatively generic suggestions, i.e. slicing may panic. Consider using .get(..n) or .get_mut(..n) instead.

It would be useful if we figured out whether get() or get_mut() were the right function to suggest and reported the index/span's actual value. After these changes the above example might look something like slicing may panic. Consider using .get_mut(..3) instead

@phansch phansch added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions labels Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

No branches or pull requests

2 participants