]> git.lizzy.rs Git - rust.git/blob - src/docs/obfuscated_if_else.txt
Add iter_kv_map lint
[rust.git] / src / docs / obfuscated_if_else.txt
1 ### What it does
2 Checks for usages of `.then_some(..).unwrap_or(..)`
3
4 ### Why is this bad?
5 This can be written more clearly with `if .. else ..`
6
7 ### Limitations
8 This lint currently only looks for usages of
9 `.then_some(..).unwrap_or(..)`, but will be expanded
10 to account for similar patterns.
11
12 ### Example
13 ```
14 let x = true;
15 x.then_some("a").unwrap_or("b");
16 ```
17 Use instead:
18 ```
19 let x = true;
20 if x { "a" } else { "b" };
21 ```