]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_wraps.stderr
Auto merge of #6764 - matthiaskrgr:lintcheck_par_iter, r=flip1995
[rust.git] / 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  ...
27
28 error: this function's return value is unnecessarily wrapped by `Option`
29   --> $DIR/unnecessary_wraps.rs:21:1
30    |
31 LL | / fn func2(a: bool, b: bool) -> Option<i32> {
32 LL | |     if a && b {
33 LL | |         return Some(10);
34 LL | |     }
35 ...  |
36 LL | |     }
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 {
49 LL |         20
50 LL |     } else {
51 LL |         30
52    |
53
54 error: this function's return value is unnecessarily wrapped by `Option`
55   --> $DIR/unnecessary_wraps.rs:51:1
56    |
57 LL | / fn func5() -> Option<i32> {
58 LL | |     Some(1)
59 LL | | }
60    | |_^
61    |
62 help: remove `Option` from the return type...
63    |
64 LL | fn func5() -> i32 {
65    |               ^^^
66 help: ...and then change returning expressions
67    |
68 LL |     1
69    |
70
71 error: this function's return value is unnecessarily wrapped by `Result`
72   --> $DIR/unnecessary_wraps.rs:61:1
73    |
74 LL | / fn func7() -> Result<i32, ()> {
75 LL | |     Ok(1)
76 LL | | }
77    | |_^
78    |
79 help: remove `Result` from the return type...
80    |
81 LL | fn func7() -> i32 {
82    |               ^^^
83 help: ...and then change returning expressions
84    |
85 LL |     1
86    |
87
88 error: this function's return value is unnecessarily wrapped by `Option`
89   --> $DIR/unnecessary_wraps.rs:93:5
90    |
91 LL | /     fn func12() -> Option<i32> {
92 LL | |         Some(1)
93 LL | |     }
94    | |_____^
95    |
96 help: remove `Option` from the return type...
97    |
98 LL |     fn func12() -> i32 {
99    |                    ^^^
100 help: ...and then change returning expressions
101    |
102 LL |         1
103    |
104
105 error: this function's return value is unnecessary
106   --> $DIR/unnecessary_wraps.rs:120:1
107    |
108 LL | / fn issue_6640_1(a: bool, b: bool) -> Option<()> {
109 LL | |     if a && b {
110 LL | |         return Some(());
111 LL | |     }
112 ...  |
113 LL | |     }
114 LL | | }
115    | |_^
116    |
117 help: remove the return type...
118    |
119 LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
120    |                                      ^^^^^^^^^^
121 help: ...and then remove returned values
122    |
123 LL |         return ;
124 LL |     }
125 LL |     if a {
126 LL |         Some(());
127 LL |         
128 LL |     } else {
129  ...
130
131 error: this function's return value is unnecessary
132   --> $DIR/unnecessary_wraps.rs:133:1
133    |
134 LL | / fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
135 LL | |     if a && b {
136 LL | |         return Ok(());
137 LL | |     }
138 ...  |
139 LL | |     }
140 LL | | }
141    | |_^
142    |
143 help: remove the return type...
144    |
145 LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
146    |                                      ^^^^^^^^^^^^^^^
147 help: ...and then remove returned values
148    |
149 LL |         return ;
150 LL |     }
151 LL |     if a {
152 LL |         
153 LL |     } else {
154 LL |         return ;
155    |
156
157 error: aborting due to 7 previous errors
158