blob: c0a23d492889a003c9b4a5380e97a267fdb5e309 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
### What it does
Checks for private functions that only return `Ok` or `Some`.
### Why is this bad?
It is not meaningful to wrap values when no `None` or `Err` is returned.
### Known problems
There can be false positives if the function signature is designed to
fit some external requirement.
### Example
```
fn get_cool_number(a: bool, b: bool) -> Option<i32> {
if a && b {
return Some(50);
}
if a {
Some(0)
} else {
Some(10)
}
}
```
Use instead:
```
fn get_cool_number(a: bool, b: bool) -> i32 {
if a && b {
return 50;
}
if a {
0
} else {
10
}
}
```
|