]> git.lizzy.rs Git - rust.git/blob - src/docs/result_map_or_into_option.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / result_map_or_into_option.txt
1 ### What it does
2 Checks for usage of `_.map_or(None, Some)`.
3
4 ### Why is this bad?
5 Readability, this can be written more concisely as
6 `_.ok()`.
7
8 ### Example
9 ```
10 assert_eq!(Some(1), r.map_or(None, Some));
11 ```
12
13 Use instead:
14 ```
15 assert_eq!(Some(1), r.ok());
16 ```