summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/box_collection.txt
blob: 053f24c46281d397f8a1fbbe661a1cfdd1037a3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### What it does
Checks for use of `Box<T>` where T is a collection such as Vec anywhere in the code.
Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information.

### Why is this bad?
Collections already keeps their contents in a separate area on
the heap. So if you `Box` them, you just add another level of indirection
without any benefit whatsoever.

### Example
```
struct X {
    values: Box<Vec<Foo>>,
}
```

Better:

```
struct X {
    values: Vec<Foo>,
}
```