about summary refs log tree commit diff
path: root/src/docs/needless_borrowed_reference.txt
blob: 152459ba1c9d78b2a50a0b9b714b61584accdd75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
### What it does
Checks for bindings that needlessly destructure a reference and borrow the inner
value with `&ref`.

### Why is this bad?
This pattern has no effect in almost all cases.

### Example
```
let mut v = Vec::<String>::new();
v.iter_mut().filter(|&ref a| a.is_empty());

if let &[ref first, ref second] = v.as_slice() {}
```

Use instead:
```
let mut v = Vec::<String>::new();
v.iter_mut().filter(|a| a.is_empty());

if let [first, second] = v.as_slice() {}
```