summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/redundant_allocation.txt
blob: 86bf51e8dfec7e546ad57eee5154dfb4b6b510b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
### What it does
Checks for use of redundant allocations anywhere in the code.

### Why is this bad?
Expressions such as `Rc<&T>`, `Rc<Rc<T>>`, `Rc<Arc<T>>`, `Rc<Box<T>>`, `Arc<&T>`, `Arc<Rc<T>>`,
`Arc<Arc<T>>`, `Arc<Box<T>>`, `Box<&T>`, `Box<Rc<T>>`, `Box<Arc<T>>`, `Box<Box<T>>`, add an unnecessary level of indirection.

### Example
```
fn foo(bar: Rc<&usize>) {}
```

Better:

```
fn foo(bar: &usize) {}
```