blob: 804b44246dc704e937b21803754e79bd18d14d6e (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
error: `unwrap` used in a function that returns a `Result`
--> tests/ui/unwrap_in_result.rs:25:17
|
LL | let i = i_str.parse::<i32>().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:23:45
|
LL | fn bad_divisible_by_3(i_str: String) -> Result<bool, String> {
| ^^^^^^^^^^^^^^^^^^^^
= help: consider using the `?` operator or calling the `.map_err()` method
= note: `-D clippy::unwrap-in-result` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unwrap_in_result)]`
error: `expect` used in a function that returns an `Option`
--> tests/ui/unwrap_in_result.rs:35:17
|
LL | let i = i_str.parse::<i32>().ok().expect("not a number");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:34:48
|
LL | fn example_option_expect(i_str: String) -> Option<bool> {
| ^^^^^^^^^^^^
= help: consider using the `?` operator
error: `unwrap` used in a function that returns an `Option`
--> tests/ui/unwrap_in_result.rs:49:17
|
LL | let _ = a.unwrap();
| ^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:43:39
|
LL | fn in_closure(a: Option<bool>) -> Option<bool> {
| ^^^^^^^^^^^^
= help: consider using the `?` operator
error: `unwrap` used in a function that returns an `Option`
--> tests/ui/unwrap_in_result.rs:58:22
|
LL | Some(b.unwrap())
| ^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:57:48
|
LL | const fn inner(b: Option<bool>) -> Option<bool> {
| ^^^^^^^^^^^^
= help: consider using the `?` operator
error: `unwrap` used in a function that returns an `Option`
--> tests/ui/unwrap_in_result.rs:71:22
|
LL | Some(b.unwrap())
| ^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:70:48
|
LL | const fn inner(b: Option<bool>) -> Option<bool> {
| ^^^^^^^^^^^^
= help: consider using the `?` operator
error: `unwrap` used in a function that returns an `Option`
--> tests/ui/unwrap_in_result.rs:89:9
|
LL | _ = Option::unwrap(Some(3));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:88:30
|
LL | fn type_relative_unwrap() -> Option<()> {
| ^^^^^^^^^^
= help: consider using the `?` operator
error: `unwrap` used in a function that returns a `Result`
--> tests/ui/unwrap_in_result.rs:99:5
|
LL | A::bad_divisible_by_3("3".to_string()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: in this function signature
--> tests/ui/unwrap_in_result.rs:98:14
|
LL | fn main() -> Result<(), ()> {
| ^^^^^^^^^^^^^^
= help: consider using the `?` operator or calling the `.map_err()` method
error: `unwrap` used in a function that returns a `Result`
--> tests/ui/unwrap_in_result.rs:101:5
|
LL | A::good_divisible_by_3("3".to_string()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `unwrap` used in a function that returns a `Result`
--> tests/ui/unwrap_in_result.rs:103:5
|
LL | Result::unwrap(A::good_divisible_by_3("3".to_string()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 9 previous errors
|