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

Add lint for indexing_slicing (IE don't panic on missing vector index) #2753

Closed
dessalines opened this issue Feb 22, 2023 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@dessalines
Copy link
Member

dessalines commented Feb 22, 2023

Rust unfortunately allows runtime errors / panics for missing vector indexes when doing my_vec[index] . Doing my_vec.get(index) returns an Option and is safer to use and deal with at compile time.

I'll have a PR for this shortly.

@dessalines dessalines added the enhancement New feature or request label Feb 22, 2023
dessalines added a commit that referenced this issue Apr 26, 2023
* Adding a vector indexing check to prevent panics. Fixes #2753

* Fixing for new clippy lint.

* Externalizing get_top_mod check. Adding get_first clippy lint

* Removing unit tests get(0)s

* Fixing some firsts manually
Nutomic pushed a commit that referenced this issue Apr 27, 2023
* Adding a vector indexing check to prevent panics. Fixes #2753

* Fixing for new clippy lint.

* Externalizing get_top_mod check. Adding get_first clippy lint

* Removing unit tests get(0)s

* Fixing some firsts manually
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant