]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/out_of_bounds_indexing.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / out_of_bounds_indexing.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for out of bounds array indexing with a constant
3index.
4
5### Why is this bad?
6This will always panic at runtime.
7
8### Example
9```
10let x = [1, 2, 3, 4];
11
12x[9];
13&x[2..9];
14```
15
16Use instead:
17```
18// Index within bounds
19
20x[0];
21x[3];
22```