diff options
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r-- | crates/assists/src/handlers/infer_function_return_type.rs | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/crates/assists/src/handlers/infer_function_return_type.rs b/crates/assists/src/handlers/infer_function_return_type.rs index 80864c530..520d07ae0 100644 --- a/crates/assists/src/handlers/infer_function_return_type.rs +++ b/crates/assists/src/handlers/infer_function_return_type.rs | |||
@@ -124,11 +124,11 @@ mod tests { | |||
124 | check_assist( | 124 | check_assist( |
125 | infer_function_return_type, | 125 | infer_function_return_type, |
126 | r#"fn foo() -> <|>_ { | 126 | r#"fn foo() -> <|>_ { |
127 | 45 | 127 | 45 |
128 | }"#, | 128 | }"#, |
129 | r#"fn foo() -> i32 { | 129 | r#"fn foo() -> i32 { |
130 | 45 | 130 | 45 |
131 | }"#, | 131 | }"#, |
132 | ); | 132 | ); |
133 | } | 133 | } |
134 | 134 | ||
@@ -138,11 +138,11 @@ mod tests { | |||
138 | check_assist( | 138 | check_assist( |
139 | infer_function_return_type, | 139 | infer_function_return_type, |
140 | r#"fn foo() { | 140 | r#"fn foo() { |
141 | || -> _ {<|>45}; | 141 | || -> _ {<|>45}; |
142 | }"#, | 142 | }"#, |
143 | r#"fn foo() { | 143 | r#"fn foo() { |
144 | || -> i32 {45}; | 144 | || -> i32 {45}; |
145 | }"#, | 145 | }"#, |
146 | ); | 146 | ); |
147 | } | 147 | } |
148 | 148 | ||
@@ -152,11 +152,11 @@ mod tests { | |||
152 | check_assist( | 152 | check_assist( |
153 | infer_function_return_type, | 153 | infer_function_return_type, |
154 | r#"fn foo() <|>{ | 154 | r#"fn foo() <|>{ |
155 | 45 | 155 | 45 |
156 | }"#, | 156 | }"#, |
157 | r#"fn foo() -> i32 { | 157 | r#"fn foo() -> i32 { |
158 | 45 | 158 | 45 |
159 | }"#, | 159 | }"#, |
160 | ); | 160 | ); |
161 | } | 161 | } |
162 | 162 | ||
@@ -166,11 +166,11 @@ mod tests { | |||
166 | check_assist( | 166 | check_assist( |
167 | infer_function_return_type, | 167 | infer_function_return_type, |
168 | r#"fn foo() { | 168 | r#"fn foo() { |
169 | || <|>45 | 169 | || <|>45 |
170 | }"#, | 170 | }"#, |
171 | r#"fn foo() { | 171 | r#"fn foo() { |
172 | || -> i32 {45} | 172 | || -> i32 {45} |
173 | }"#, | 173 | }"#, |
174 | ); | 174 | ); |
175 | } | 175 | } |
176 | 176 | ||
@@ -180,11 +180,11 @@ mod tests { | |||
180 | check_assist( | 180 | check_assist( |
181 | infer_function_return_type, | 181 | infer_function_return_type, |
182 | r#"fn foo() { | 182 | r#"fn foo() { |
183 | 45<|> | 183 | 45<|> |
184 | }"#, | 184 | }"#, |
185 | r#"fn foo() -> i32 { | 185 | r#"fn foo() -> i32 { |
186 | 45 | 186 | 45 |
187 | }"#, | 187 | }"#, |
188 | ); | 188 | ); |
189 | } | 189 | } |
190 | 190 | ||
@@ -193,19 +193,19 @@ mod tests { | |||
193 | check_assist( | 193 | check_assist( |
194 | infer_function_return_type, | 194 | infer_function_return_type, |
195 | r#"fn foo() { | 195 | r#"fn foo() { |
196 | if true { | 196 | if true { |
197 | 3<|> | 197 | 3<|> |
198 | } else { | 198 | } else { |
199 | 5 | 199 | 5 |
200 | } | 200 | } |
201 | }"#, | 201 | }"#, |
202 | r#"fn foo() -> i32 { | 202 | r#"fn foo() -> i32 { |
203 | if true { | 203 | if true { |
204 | 3 | 204 | 3 |
205 | } else { | 205 | } else { |
206 | 5 | 206 | 5 |
207 | } | 207 | } |
208 | }"#, | 208 | }"#, |
209 | ); | 209 | ); |
210 | } | 210 | } |
211 | 211 | ||
@@ -215,8 +215,8 @@ mod tests { | |||
215 | check_assist_not_applicable( | 215 | check_assist_not_applicable( |
216 | infer_function_return_type, | 216 | infer_function_return_type, |
217 | r#"fn foo() -> i32 { | 217 | r#"fn foo() -> i32 { |
218 | ( 45<|> + 32 ) * 123 | 218 | ( 45<|> + 32 ) * 123 |
219 | }"#, | 219 | }"#, |
220 | ); | 220 | ); |
221 | } | 221 | } |
222 | 222 | ||
@@ -225,9 +225,9 @@ mod tests { | |||
225 | check_assist_not_applicable( | 225 | check_assist_not_applicable( |
226 | infer_function_return_type, | 226 | infer_function_return_type, |
227 | r#"fn foo() { | 227 | r#"fn foo() { |
228 | let x = <|>3; | 228 | let x = <|>3; |
229 | ( 45 + 32 ) * 123 | 229 | ( 45 + 32 ) * 123 |
230 | }"#, | 230 | }"#, |
231 | ); | 231 | ); |
232 | } | 232 | } |
233 | 233 | ||
@@ -236,8 +236,8 @@ mod tests { | |||
236 | check_assist_not_applicable( | 236 | check_assist_not_applicable( |
237 | infer_function_return_type, | 237 | infer_function_return_type, |
238 | r#"fn foo() { | 238 | r#"fn foo() { |
239 | (<|>) | 239 | (<|>) |
240 | }"#, | 240 | }"#, |
241 | ); | 241 | ); |
242 | } | 242 | } |
243 | 243 | ||
@@ -247,15 +247,15 @@ mod tests { | |||
247 | check_assist( | 247 | check_assist( |
248 | infer_function_return_type, | 248 | infer_function_return_type, |
249 | r#"fn foo() { | 249 | r#"fn foo() { |
250 | |x: i32| { | 250 | |x: i32| { |
251 | x<|> | 251 | x<|> |
252 | }; | 252 | }; |
253 | }"#, | 253 | }"#, |
254 | r#"fn foo() { | 254 | r#"fn foo() { |
255 | |x: i32| -> i32 { | 255 | |x: i32| -> i32 { |
256 | x | 256 | x |
257 | }; | 257 | }; |
258 | }"#, | 258 | }"#, |
259 | ); | 259 | ); |
260 | } | 260 | } |
261 | 261 | ||
@@ -264,11 +264,11 @@ mod tests { | |||
264 | check_assist( | 264 | check_assist( |
265 | infer_function_return_type, | 265 | infer_function_return_type, |
266 | r#"fn foo() { | 266 | r#"fn foo() { |
267 | |x: i32| { x<|> }; | 267 | |x: i32| { x<|> }; |
268 | }"#, | 268 | }"#, |
269 | r#"fn foo() { | 269 | r#"fn foo() { |
270 | |x: i32| -> i32 { x }; | 270 | |x: i32| -> i32 { x }; |
271 | }"#, | 271 | }"#, |
272 | ); | 272 | ); |
273 | } | 273 | } |
274 | 274 | ||
@@ -278,11 +278,11 @@ mod tests { | |||
278 | check_assist( | 278 | check_assist( |
279 | infer_function_return_type, | 279 | infer_function_return_type, |
280 | r#"fn foo() { | 280 | r#"fn foo() { |
281 | |x: i32| x<|>; | 281 | |x: i32| x<|>; |
282 | }"#, | 282 | }"#, |
283 | r#"fn foo() { | 283 | r#"fn foo() { |
284 | |x: i32| -> i32 {x}; | 284 | |x: i32| -> i32 {x}; |
285 | }"#, | 285 | }"#, |
286 | ); | 286 | ); |
287 | } | 287 | } |
288 | 288 | ||
@@ -291,23 +291,23 @@ mod tests { | |||
291 | check_assist( | 291 | check_assist( |
292 | infer_function_return_type, | 292 | infer_function_return_type, |
293 | r#"fn foo() { | 293 | r#"fn foo() { |
294 | || { | 294 | || { |
295 | if true { | 295 | if true { |
296 | 3<|> | 296 | 3<|> |
297 | } else { | 297 | } else { |
298 | 5 | 298 | 5 |
299 | } | 299 | } |
300 | } | 300 | } |
301 | }"#, | 301 | }"#, |
302 | r#"fn foo() { | 302 | r#"fn foo() { |
303 | || -> i32 { | 303 | || -> i32 { |
304 | if true { | 304 | if true { |
305 | 3 | 305 | 3 |
306 | } else { | 306 | } else { |
307 | 5 | 307 | 5 |
308 | } | 308 | } |
309 | } | 309 | } |
310 | }"#, | 310 | }"#, |
311 | ); | 311 | ); |
312 | } | 312 | } |
313 | 313 | ||
@@ -317,8 +317,8 @@ mod tests { | |||
317 | check_assist_not_applicable( | 317 | check_assist_not_applicable( |
318 | infer_function_return_type, | 318 | infer_function_return_type, |
319 | r#"fn foo() { | 319 | r#"fn foo() { |
320 | || -> i32 { 3<|> } | 320 | || -> i32 { 3<|> } |
321 | }"#, | 321 | }"#, |
322 | ); | 322 | ); |
323 | } | 323 | } |
324 | 324 | ||
@@ -327,11 +327,11 @@ mod tests { | |||
327 | check_assist_not_applicable( | 327 | check_assist_not_applicable( |
328 | infer_function_return_type, | 328 | infer_function_return_type, |
329 | r#"fn foo() { | 329 | r#"fn foo() { |
330 | || -> i32 { | 330 | || -> i32 { |
331 | let x = 3<|>; | 331 | let x = 3<|>; |
332 | 6 | 332 | 6 |
333 | } | 333 | } |
334 | }"#, | 334 | }"#, |
335 | ); | 335 | ); |
336 | } | 336 | } |
337 | } | 337 | } |