blob: 1fd7d831bfca2a44771e5321e0679d7013698cdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
### What it does
Finds patterns that reimplement `Option::unwrap_or` or `Result::unwrap_or`.
### Why is this bad?
Concise code helps focusing on behavior instead of boilerplate.
### Example
```
let foo: Option<i32> = None;
match foo {
Some(v) => v,
None => 1,
};
```
Use instead:
```
let foo: Option<i32> = None;
foo.unwrap_or(1);
```
|