]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_wraps.stderr
Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr
[rust.git] / src / tools / clippy / tests / ui / unnecessary_wraps.stderr
1 error: this function's return value is unnecessarily wrapped by `Option`
2   --> $DIR/unnecessary_wraps.rs:8:1
3    |
4 LL | / fn func1(a: bool, b: bool) -> Option<i32> {
5 LL | |     if a && b {
6 LL | |         return Some(42);
7 LL | |     }
8 ...  |
9 LL | |     }
10 LL | | }
11    | |_^
12    |
13    = note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
14 help: remove `Option` from the return type...
15    |
16 LL | fn func1(a: bool, b: bool) -> i32 {
17    |                               ~~~
18 help: ...and then change returning expressions
19    |
20 LL ~         return 42;
21 LL |     }
22 LL |     if a {
23 LL |         Some(-1);
24 LL ~         2
25 LL |     } else {
26 LL ~         return 1337;
27    |
28
29 error: this function's return value is unnecessarily wrapped by `Option`
30   --> $DIR/unnecessary_wraps.rs:21:1
31    |
32 LL | / fn func2(a: bool, b: bool) -> Option<i32> {
33 LL | |     if a && b {
34 LL | |         return Some(10);
35 LL | |     }
36 LL | |     if a { Some(20) } else { Some(30) }
37 LL | | }
38    | |_^
39    |
40 help: remove `Option` from the return type...
41    |
42 LL | fn func2(a: bool, b: bool) -> i32 {
43    |                               ~~~
44 help: ...and then change returning expressions
45    |
46 LL ~         return 10;
47 LL |     }
48 LL ~     if a { 20 } else { 30 }
49    |
50
51 error: this function's return value is unnecessarily wrapped by `Option`
52   --> $DIR/unnecessary_wraps.rs:39:1
53    |
54 LL | / fn func5() -> Option<i32> {
55 LL | |     Some(1)
56 LL | | }
57    | |_^
58    |
59 help: remove `Option` from the return type...
60    |
61 LL | fn func5() -> i32 {
62    |               ~~~
63 help: ...and then change returning expressions
64    |
65 LL |     1
66    |
67
68 error: this function's return value is unnecessarily wrapped by `Result`
69   --> $DIR/unnecessary_wraps.rs:49:1
70    |
71 LL | / fn func7() -> Result<i32, ()> {
72 LL | |     Ok(1)
73 LL | | }
74    | |_^
75    |
76 help: remove `Result` from the return type...
77    |
78 LL | fn func7() -> i32 {
79    |               ~~~
80 help: ...and then change returning expressions
81    |
82 LL |     1
83    |
84
85 error: this function's return value is unnecessarily wrapped by `Option`
86   --> $DIR/unnecessary_wraps.rs:77:5
87    |
88 LL | /     fn func12() -> Option<i32> {
89 LL | |         Some(1)
90 LL | |     }
91    | |_____^
92    |
93 help: remove `Option` from the return type...
94    |
95 LL |     fn func12() -> i32 {
96    |                    ~~~
97 help: ...and then change returning expressions
98    |
99 LL |         1
100    |
101
102 error: this function's return value is unnecessary
103   --> $DIR/unnecessary_wraps.rs:104:1
104    |
105 LL | / fn issue_6640_1(a: bool, b: bool) -> Option<()> {
106 LL | |     if a && b {
107 LL | |         return Some(());
108 LL | |     }
109 ...  |
110 LL | |     }
111 LL | | }
112    | |_^
113    |
114 help: remove the return type...
115    |
116 LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
117    |                                      ~~~~~~~~~~
118 help: ...and then remove returned values
119    |
120 LL ~         return ;
121 LL |     }
122 LL |     if a {
123 LL |         Some(());
124 LL ~         
125 LL |     } else {
126 LL ~         return ;
127    |
128
129 error: this function's return value is unnecessary
130   --> $DIR/unnecessary_wraps.rs:117:1
131    |
132 LL | / fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
133 LL | |     if a && b {
134 LL | |         return Ok(());
135 LL | |     }
136 ...  |
137 LL | |     }
138 LL | | }
139    | |_^
140    |
141 help: remove the return type...
142    |
143 LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
144    |                                      ~~~~~~~~~~~~~~~
145 help: ...and then remove returned values
146    |
147 LL ~         return ;
148 LL |     }
149 LL |     if a {
150 LL ~         
151 LL |     } else {
152 LL ~         return ;
153    |
154
155 error: aborting due to 7 previous errors
156