summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/match_bool.txt
blob: 96f9e1f8b7d1bfb503d685bb7861da665d8616f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
### What it does
Checks for matches where match expression is a `bool`. It
suggests to replace the expression with an `if...else` block.

### Why is this bad?
It makes the code less readable.

### Example
```
let condition: bool = true;
match condition {
    true => foo(),
    false => bar(),
}
```
Use if/else instead:
```
let condition: bool = true;
if condition {
    foo();
} else {
    bar();
}
```