Commit 79c684d
committed
Auto merge of #10692 - y21:missing-asserts, r=Alexendoo
new lint: `missing_asserts_for_indexing`
Fixes #8296
This lint looks for repeated slice indexing and suggests adding an `assert!` beforehand that helps LLVM elide bounds checks. The lint documentation has an example.
I'm not really sure what category this should be in. It seems like a nice lint for the `perf` category but I suspect this has a pretty high FP rate, so it might have to be a pedantic lint or something.
I'm also not sure about the name. If someone knows a better name for this lint, I'd be fine with changing it.
changelog: new lint [`missing_asserts_for_indexing`]File tree
9 files changed
+1101
-0
lines changed- clippy_lints/src
- tests/ui
9 files changed
+1101
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5132 | 5132 | | |
5133 | 5133 | | |
5134 | 5134 | | |
| 5135 | + | |
5135 | 5136 | | |
5136 | 5137 | | |
5137 | 5138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
460 | 461 | | |
461 | 462 | | |
462 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| |||
1100 | 1101 | | |
1101 | 1102 | | |
1102 | 1103 | | |
| 1104 | + | |
1103 | 1105 | | |
1104 | 1106 | | |
1105 | 1107 | | |
| |||
0 commit comments