]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/match_bool.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / match_bool.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for matches where match expression is a `bool`. It
3suggests to replace the expression with an `if...else` block.
4
5### Why is this bad?
6It makes the code less readable.
7
8### Example
9```
10let condition: bool = true;
11match condition {
12 true => foo(),
13 false => bar(),
14}
15```
16Use if/else instead:
17```
18let condition: bool = true;
19if condition {
20 foo();
21} else {
22 bar();
23}
24```