]> git.lizzy.rs Git - rust.git/blob - src/docs/match_bool.txt
Add iter_kv_map lint
[rust.git] / src / docs / match_bool.txt
1 ### What it does
2 Checks for matches where match expression is a `bool`. It
3 suggests to replace the expression with an `if...else` block.
4
5 ### Why is this bad?
6 It makes the code less readable.
7
8 ### Example
9 ```
10 let condition: bool = true;
11 match condition {
12     true => foo(),
13     false => bar(),
14 }
15 ```
16 Use if/else instead:
17 ```
18 let condition: bool = true;
19 if condition {
20     foo();
21 } else {
22     bar();
23 }
24 ```