rust/src/docs/ref_binding_to_reference.txt
2022-09-09 13:36:26 +02:00

21 lines
No EOL
358 B
Text

### 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
}
```