1
1
error: this function's return value is unnecessarily wrapped by `Option`
2
2
--> tests/ui/unnecessary_wraps.rs:9:1
3
3
|
4
- LL | / fn func1(a: bool, b: bool) -> Option<i32> {
5
- LL | |
6
- LL | |
7
- LL | | if a && b {
8
- ... |
9
- LL | | }
10
- | |_^
4
+ LL | fn func1(a: bool, b: bool) -> Option<i32> {
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11
6
|
12
7
= note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
13
8
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_wraps)]`
@@ -30,14 +25,8 @@ LL ~ return 1337;
30
25
error: this function's return value is unnecessarily wrapped by `Option`
31
26
--> tests/ui/unnecessary_wraps.rs:24:1
32
27
|
33
- LL | / fn func2(a: bool, b: bool) -> Option<i32> {
34
- LL | |
35
- LL | |
36
- LL | | if a && b {
37
- ... |
38
- LL | | if a { Some(20) } else { Some(30) }
39
- LL | | }
40
- | |_^
28
+ LL | fn func2(a: bool, b: bool) -> Option<i32> {
29
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41
30
|
42
31
help: remove `Option` from the return type...
43
32
|
@@ -54,12 +43,8 @@ LL ~ if a { 20 } else { 30 }
54
43
error: this function's return value is unnecessarily wrapped by `Option`
55
44
--> tests/ui/unnecessary_wraps.rs:44:1
56
45
|
57
- LL | / fn func5() -> Option<i32> {
58
- LL | |
59
- LL | |
60
- LL | | Some(1)
61
- LL | | }
62
- | |_^
46
+ LL | fn func5() -> Option<i32> {
47
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
63
48
|
64
49
help: remove `Option` from the return type...
65
50
|
@@ -75,12 +60,8 @@ LL + 1
75
60
error: this function's return value is unnecessarily wrapped by `Result`
76
61
--> tests/ui/unnecessary_wraps.rs:56:1
77
62
|
78
- LL | / fn func7() -> Result<i32, ()> {
79
- LL | |
80
- LL | |
81
- LL | | Ok(1)
82
- LL | | }
83
- | |_^
63
+ LL | fn func7() -> Result<i32, ()> {
64
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84
65
|
85
66
help: remove `Result` from the return type...
86
67
|
@@ -96,12 +77,8 @@ LL + 1
96
77
error: this function's return value is unnecessarily wrapped by `Option`
97
78
--> tests/ui/unnecessary_wraps.rs:86:5
98
79
|
99
- LL | / fn func12() -> Option<i32> {
100
- LL | |
101
- LL | |
102
- LL | | Some(1)
103
- LL | | }
104
- | |_____^
80
+ LL | fn func12() -> Option<i32> {
81
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
105
82
|
106
83
help: remove `Option` from the return type...
107
84
|
@@ -117,13 +94,8 @@ LL + 1
117
94
error: this function's return value is unnecessary
118
95
--> tests/ui/unnecessary_wraps.rs:115:1
119
96
|
120
- LL | / fn issue_6640_1(a: bool, b: bool) -> Option<()> {
121
- LL | |
122
- LL | |
123
- LL | | if a && b {
124
- ... |
125
- LL | | }
126
- | |_^
97
+ LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
98
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127
99
|
128
100
help: remove the return type...
129
101
|
@@ -144,13 +116,8 @@ LL ~ return ;
144
116
error: this function's return value is unnecessary
145
117
--> tests/ui/unnecessary_wraps.rs:130:1
146
118
|
147
- LL | / fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
148
- LL | |
149
- LL | |
150
- LL | | if a && b {
151
- ... |
152
- LL | | }
153
- | |_^
119
+ LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
120
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154
121
|
155
122
help: remove the return type...
156
123
|
0 commit comments