11error: this function's return value is unnecessarily wrapped by `Option`
22 --> tests/ui/unnecessary_wraps.rs:9:1
33 |
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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116 |
127 = note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
138 = help: to override `-D warnings` add `#[allow(clippy::unnecessary_wraps)]`
@@ -16,7 +11,7 @@ help: remove `Option` from the return type...
1611LL - fn func1(a: bool, b: bool) -> Option<i32> {
1712LL + fn func1(a: bool, b: bool) -> i32 {
1813 |
19- help: ...and then change returning expressions
14+ help: ...and then remove the surrounding `Some()` from returning expressions
2015 |
2116LL ~ return 42;
2217LL | }
@@ -30,21 +25,15 @@ LL ~ return 1337;
3025error: this function's return value is unnecessarily wrapped by `Option`
3126 --> tests/ui/unnecessary_wraps.rs:24:1
3227 |
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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4130 |
4231help: remove `Option` from the return type...
4332 |
4433LL - fn func2(a: bool, b: bool) -> Option<i32> {
4534LL + fn func2(a: bool, b: bool) -> i32 {
4635 |
47- help: ...and then change returning expressions
36+ help: ...and then remove the surrounding `Some()` from returning expressions
4837 |
4938LL ~ return 10;
5039LL | }
@@ -54,19 +43,15 @@ LL ~ if a { 20 } else { 30 }
5443error: this function's return value is unnecessarily wrapped by `Option`
5544 --> tests/ui/unnecessary_wraps.rs:44:1
5645 |
57- LL | / fn func5() -> Option<i32> {
58- LL | |
59- LL | |
60- LL | | Some(1)
61- LL | | }
62- | |_^
46+ LL | fn func5() -> Option<i32> {
47+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6348 |
6449help: remove `Option` from the return type...
6550 |
6651LL - fn func5() -> Option<i32> {
6752LL + fn func5() -> i32 {
6853 |
69- help: ...and then change returning expressions
54+ help: ...and then remove the surrounding `Some()` from returning expressions
7055 |
7156LL - Some(1)
7257LL + 1
@@ -75,19 +60,15 @@ LL + 1
7560error: this function's return value is unnecessarily wrapped by `Result`
7661 --> tests/ui/unnecessary_wraps.rs:56:1
7762 |
78- LL | / fn func7() -> Result<i32, ()> {
79- LL | |
80- LL | |
81- LL | | Ok(1)
82- LL | | }
83- | |_^
63+ LL | fn func7() -> Result<i32, ()> {
64+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8465 |
8566help: remove `Result` from the return type...
8667 |
8768LL - fn func7() -> Result<i32, ()> {
8869LL + fn func7() -> i32 {
8970 |
90- help: ...and then change returning expressions
71+ help: ...and then remove the surrounding `Ok()` from returning expressions
9172 |
9273LL - Ok(1)
9374LL + 1
@@ -96,19 +77,15 @@ LL + 1
9677error: this function's return value is unnecessarily wrapped by `Option`
9778 --> tests/ui/unnecessary_wraps.rs:86:5
9879 |
99- LL | / fn func12() -> Option<i32> {
100- LL | |
101- LL | |
102- LL | | Some(1)
103- LL | | }
104- | |_____^
80+ LL | fn func12() -> Option<i32> {
81+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
10582 |
10683help: remove `Option` from the return type...
10784 |
10885LL - fn func12() -> Option<i32> {
10986LL + fn func12() -> i32 {
11087 |
111- help: ...and then change returning expressions
88+ help: ...and then remove the surrounding `Some()` from returning expressions
11289 |
11390LL - Some(1)
11491LL + 1
@@ -117,13 +94,8 @@ LL + 1
11794error: this function's return value is unnecessary
11895 --> tests/ui/unnecessary_wraps.rs:115:1
11996 |
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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12799 |
128100help: remove the return type...
129101 |
@@ -144,13 +116,8 @@ LL ~ return ;
144116error: this function's return value is unnecessary
145117 --> tests/ui/unnecessary_wraps.rs:130:1
146118 |
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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154121 |
155122help: remove the return type...
156123 |
0 commit comments