summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/extend_with_drain.txt
blob: 2f31dcf5f74013c933a071068115a2de1a20945e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
### What it does
Checks for occurrences where one vector gets extended instead of append

### Why is this bad?
Using `append` instead of `extend` is more concise and faster

### Example
```
let mut a = vec![1, 2, 3];
let mut b = vec![4, 5, 6];

a.extend(b.drain(..));
```

Use instead:
```
let mut a = vec![1, 2, 3];
let mut b = vec![4, 5, 6];

a.append(&mut b);
```