summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cmp_owned.txt
blob: f8d4956ff1d4b7b010df92dffb8ccc7a16dc1684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### What it does
Checks for conversions to owned values just for the sake
of a comparison.

### Why is this bad?
The comparison can operate on a reference, so creating
an owned value effectively throws it away directly afterwards, which is
needlessly consuming code and heap space.

### Example
```
if x.to_owned() == y {}
```

Use instead:
```
if x == y {}
```