summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/ref_binding_to_reference.txt
blob: dc391cd988e587d66b20a9bd3def86dcafcc6b53 (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 `ref` bindings which create a reference to a reference.

### Why is this bad?
The address-of operator at the use site is clearer about the need for a reference.

### Example
```
let x = Some("");
if let Some(ref x) = x {
    // use `x` here
}
```

Use instead:
```
let x = Some("");
if let Some(x) = x {
    // use `&x` here
}
```