summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/obfuscated_if_else.txt
blob: 638f63b0db5e4a6a59de5db19721beb6c113c78f (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 usages of `.then_some(..).unwrap_or(..)`

### Why is this bad?
This can be written more clearly with `if .. else ..`

### Limitations
This lint currently only looks for usages of
`.then_some(..).unwrap_or(..)`, but will be expanded
to account for similar patterns.

### Example
```
let x = true;
x.then_some("a").unwrap_or("b");
```
Use instead:
```
let x = true;
if x { "a" } else { "b" };
```