summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/shadow_reuse.txt
blob: 9eb8e7ad164bbe5c501309a8633080ac369b018f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
### What it does
Checks for bindings that shadow other bindings already in
scope, while reusing the original value.

### Why is this bad?
Not too much, in fact it's a common pattern in Rust
code. Still, some argue that name shadowing like this hurts readability,
because a value may be bound to different things depending on position in
the code.

### Example
```
let x = 2;
let x = x + 1;
```
use different variable name:
```
let x = 2;
let y = x + 1;
```