summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/option_map_or_none.txt
blob: c86c65215f01c2c255cf97153ac72ed454e9d3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
### What it does
Checks for usage of `_.map_or(None, _)`.

### Why is this bad?
Readability, this can be written more concisely as
`_.and_then(_)`.

### Known problems
The order of the arguments is not in execution order.

### Example
```
opt.map_or(None, |a| Some(a + 1));
```

Use instead:
```
opt.and_then(|a| Some(a + 1));
```