Closed
Description
👋
I'm interested in contributing a lint I've put together but would love some feedback before starting the PR process. The general idea is that I'd like to dissuade behavior that could cause a runtime panic in my project, in this case, indexing.
Some preliminary work behaves something like the following:
fn main() {
// Vector containing a single element.
let x = vec![0;1];
let _a = x[10];
//~^ WARNING indexing can result in runtime panics
let _b = &x[10..];
//~^ WARNING ranged indexing with start/end values can result in runtime panics
let _c = &x[..10];
//~^ WARNING ranged indexing with start/end values can result in runtime panics
let _d = &x[10..100];
//~^ WARNING ranged indexing with start/end values can result in runtime panics
let _e = &x[..]; // OK
}
I guess to start, I'm interested in whether this lint seems like could fit in here. If it does we can go from there, thanks!
Metadata
Metadata
Assignees
Labels
No labels