summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/get_first.txt
blob: c905a737ddf3ff4ff2e27faf5f502b9e69a93c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
### What it does
Checks for using `x.get(0)` instead of
`x.first()`.

### Why is this bad?
Using `x.first()` is easier to read and has the same
result.

### Example
```
let x = vec![2, 3, 5];
let first_element = x.get(0);
```

Use instead:
```
let x = vec![2, 3, 5];
let first_element = x.first();
```