diff options
author | Phil Ellison <[email protected]> | 2019-07-28 12:08:06 +0100 |
---|---|---|
committer | Phil Ellison <[email protected]> | 2019-07-28 12:08:06 +0100 |
commit | 5c4df97996ac88133c12069debff1f86d3a9f7cb (patch) | |
tree | 50191919a9d6462b1edafff44df9c36449d89cc4 /crates/ra_ide_api/src/completion/presentation.rs | |
parent | 9f6909c0ce678e738a39789687af8a12e02d0be1 (diff) |
cargo format
Diffstat (limited to 'crates/ra_ide_api/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index fe7581adf..5df19990c 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -182,9 +182,9 @@ impl Completions { | |||
182 | 182 | ||
183 | #[cfg(test)] | 183 | #[cfg(test)] |
184 | mod tests { | 184 | mod tests { |
185 | use test_utils::covers; | ||
186 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; | 185 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
187 | use insta::assert_debug_snapshot_matches; | 186 | use insta::assert_debug_snapshot_matches; |
187 | use test_utils::covers; | ||
188 | 188 | ||
189 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { | 189 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { |
190 | do_completion(code, CompletionKind::Reference) | 190 | do_completion(code, CompletionKind::Reference) |
@@ -194,13 +194,13 @@ mod tests { | |||
194 | fn inserts_parens_for_function_calls() { | 194 | fn inserts_parens_for_function_calls() { |
195 | covers!(inserts_parens_for_function_calls); | 195 | covers!(inserts_parens_for_function_calls); |
196 | assert_debug_snapshot_matches!( | 196 | assert_debug_snapshot_matches!( |
197 | do_reference_completion( | 197 | do_reference_completion( |
198 | r" | 198 | r" |
199 | fn no_args() {} | 199 | fn no_args() {} |
200 | fn main() { no_<|> } | 200 | fn main() { no_<|> } |
201 | " | 201 | " |
202 | ), | 202 | ), |
203 | @r###" | 203 | @r###" |
204 | ⋮[ | 204 | ⋮[ |
205 | ⋮ CompletionItem { | 205 | ⋮ CompletionItem { |
206 | ⋮ label: "main", | 206 | ⋮ label: "main", |
@@ -220,15 +220,15 @@ mod tests { | |||
220 | ⋮ }, | 220 | ⋮ }, |
221 | ⋮] | 221 | ⋮] |
222 | "### | 222 | "### |
223 | ); | 223 | ); |
224 | assert_debug_snapshot_matches!( | 224 | assert_debug_snapshot_matches!( |
225 | do_reference_completion( | 225 | do_reference_completion( |
226 | r" | 226 | r" |
227 | fn with_args(x: i32, y: String) {} | 227 | fn with_args(x: i32, y: String) {} |
228 | fn main() { with_<|> } | 228 | fn main() { with_<|> } |
229 | " | 229 | " |
230 | ), | 230 | ), |
231 | @r###" | 231 | @r###" |
232 | ⋮[ | 232 | ⋮[ |
233 | ⋮ CompletionItem { | 233 | ⋮ CompletionItem { |
234 | ⋮ label: "main", | 234 | ⋮ label: "main", |
@@ -248,10 +248,10 @@ mod tests { | |||
248 | ⋮ }, | 248 | ⋮ }, |
249 | ⋮] | 249 | ⋮] |
250 | "### | 250 | "### |
251 | ); | 251 | ); |
252 | assert_debug_snapshot_matches!( | 252 | assert_debug_snapshot_matches!( |
253 | do_reference_completion( | 253 | do_reference_completion( |
254 | r" | 254 | r" |
255 | struct S {} | 255 | struct S {} |
256 | impl S { | 256 | impl S { |
257 | fn foo(&self) {} | 257 | fn foo(&self) {} |
@@ -260,8 +260,8 @@ mod tests { | |||
260 | s.f<|> | 260 | s.f<|> |
261 | } | 261 | } |
262 | " | 262 | " |
263 | ), | 263 | ), |
264 | @r###" | 264 | @r###" |
265 | ⋮[ | 265 | ⋮[ |
266 | ⋮ CompletionItem { | 266 | ⋮ CompletionItem { |
267 | ⋮ label: "foo", | 267 | ⋮ label: "foo", |
@@ -273,20 +273,20 @@ mod tests { | |||
273 | ⋮ }, | 273 | ⋮ }, |
274 | ⋮] | 274 | ⋮] |
275 | "### | 275 | "### |
276 | ); | 276 | ); |
277 | } | 277 | } |
278 | 278 | ||
279 | #[test] | 279 | #[test] |
280 | fn dont_render_function_parens_in_use_item() { | 280 | fn dont_render_function_parens_in_use_item() { |
281 | assert_debug_snapshot_matches!( | 281 | assert_debug_snapshot_matches!( |
282 | do_reference_completion( | 282 | do_reference_completion( |
283 | " | 283 | " |
284 | //- /lib.rs | 284 | //- /lib.rs |
285 | mod m { pub fn foo() {} } | 285 | mod m { pub fn foo() {} } |
286 | use crate::m::f<|>; | 286 | use crate::m::f<|>; |
287 | " | 287 | " |
288 | ), | 288 | ), |
289 | @r#"[ | 289 | @r#"[ |
290 | CompletionItem { | 290 | CompletionItem { |
291 | label: "foo", | 291 | label: "foo", |
292 | source_range: [40; 41), | 292 | source_range: [40; 41), |
@@ -296,22 +296,22 @@ mod tests { | |||
296 | detail: "pub fn foo()", | 296 | detail: "pub fn foo()", |
297 | }, | 297 | }, |
298 | ]"# | 298 | ]"# |
299 | ); | 299 | ); |
300 | } | 300 | } |
301 | 301 | ||
302 | #[test] | 302 | #[test] |
303 | fn dont_render_function_parens_if_already_call() { | 303 | fn dont_render_function_parens_if_already_call() { |
304 | assert_debug_snapshot_matches!( | 304 | assert_debug_snapshot_matches!( |
305 | do_reference_completion( | 305 | do_reference_completion( |
306 | " | 306 | " |
307 | //- /lib.rs | 307 | //- /lib.rs |
308 | fn frobnicate() {} | 308 | fn frobnicate() {} |
309 | fn main() { | 309 | fn main() { |
310 | frob<|>(); | 310 | frob<|>(); |
311 | } | 311 | } |
312 | " | 312 | " |
313 | ), | 313 | ), |
314 | @r#"[ | 314 | @r#"[ |
315 | CompletionItem { | 315 | CompletionItem { |
316 | label: "frobnicate", | 316 | label: "frobnicate", |
317 | source_range: [35; 39), | 317 | source_range: [35; 39), |
@@ -329,10 +329,10 @@ mod tests { | |||
329 | detail: "fn main()", | 329 | detail: "fn main()", |
330 | }, | 330 | }, |
331 | ]"# | 331 | ]"# |
332 | ); | 332 | ); |
333 | assert_debug_snapshot_matches!( | 333 | assert_debug_snapshot_matches!( |
334 | do_reference_completion( | 334 | do_reference_completion( |
335 | " | 335 | " |
336 | //- /lib.rs | 336 | //- /lib.rs |
337 | struct Foo {} | 337 | struct Foo {} |
338 | impl Foo { fn new() -> Foo {} } | 338 | impl Foo { fn new() -> Foo {} } |
@@ -340,8 +340,8 @@ mod tests { | |||
340 | Foo::ne<|>(); | 340 | Foo::ne<|>(); |
341 | } | 341 | } |
342 | " | 342 | " |
343 | ), | 343 | ), |
344 | @r#"[ | 344 | @r#"[ |
345 | CompletionItem { | 345 | CompletionItem { |
346 | label: "new", | 346 | label: "new", |
347 | source_range: [67; 69), | 347 | source_range: [67; 69), |
@@ -351,6 +351,6 @@ mod tests { | |||
351 | detail: "fn new() -> Foo", | 351 | detail: "fn new() -> Foo", |
352 | }, | 352 | }, |
353 | ]"# | 353 | ]"# |
354 | ); | 354 | ); |
355 | } | 355 | } |
356 | } | 356 | } |