diff options
author | Jonas Schievink <[email protected]> | 2020-06-15 21:39:26 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-06-15 21:39:26 +0100 |
commit | 71c002e58947a7e19d2ba4bc41336618a087824b (patch) | |
tree | 914243a11ab07d07f5dbbac788460c6ec2461426 /crates/ra_assists/src | |
parent | 5d66bfe16343141132c8a7aefa727b209ec3e66a (diff) |
It's fookin' raw
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs index 6cbf8309b..301ae8497 100644 --- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs | |||
@@ -152,10 +152,10 @@ mod tests { | |||
152 | fn test_replace_add_use_no_anchor() { | 152 | fn test_replace_add_use_no_anchor() { |
153 | check_assist( | 153 | check_assist( |
154 | replace_qualified_name_with_use, | 154 | replace_qualified_name_with_use, |
155 | " | 155 | r" |
156 | std::fmt::Debug<|> | 156 | std::fmt::Debug<|> |
157 | ", | 157 | ", |
158 | " | 158 | r" |
159 | use std::fmt::Debug; | 159 | use std::fmt::Debug; |
160 | 160 | ||
161 | Debug | 161 | Debug |
@@ -166,13 +166,13 @@ Debug | |||
166 | fn test_replace_add_use_no_anchor_with_item_below() { | 166 | fn test_replace_add_use_no_anchor_with_item_below() { |
167 | check_assist( | 167 | check_assist( |
168 | replace_qualified_name_with_use, | 168 | replace_qualified_name_with_use, |
169 | " | 169 | r" |
170 | std::fmt::Debug<|> | 170 | std::fmt::Debug<|> |
171 | 171 | ||
172 | fn main() { | 172 | fn main() { |
173 | } | 173 | } |
174 | ", | 174 | ", |
175 | " | 175 | r" |
176 | use std::fmt::Debug; | 176 | use std::fmt::Debug; |
177 | 177 | ||
178 | Debug | 178 | Debug |
@@ -187,13 +187,13 @@ fn main() { | |||
187 | fn test_replace_add_use_no_anchor_with_item_above() { | 187 | fn test_replace_add_use_no_anchor_with_item_above() { |
188 | check_assist( | 188 | check_assist( |
189 | replace_qualified_name_with_use, | 189 | replace_qualified_name_with_use, |
190 | " | 190 | r" |
191 | fn main() { | 191 | fn main() { |
192 | } | 192 | } |
193 | 193 | ||
194 | std::fmt::Debug<|> | 194 | std::fmt::Debug<|> |
195 | ", | 195 | ", |
196 | " | 196 | r" |
197 | use std::fmt::Debug; | 197 | use std::fmt::Debug; |
198 | 198 | ||
199 | fn main() { | 199 | fn main() { |
@@ -208,10 +208,10 @@ Debug | |||
208 | fn test_replace_add_use_no_anchor_2seg() { | 208 | fn test_replace_add_use_no_anchor_2seg() { |
209 | check_assist( | 209 | check_assist( |
210 | replace_qualified_name_with_use, | 210 | replace_qualified_name_with_use, |
211 | " | 211 | r" |
212 | std::fmt<|>::Debug | 212 | std::fmt<|>::Debug |
213 | ", | 213 | ", |
214 | " | 214 | r" |
215 | use std::fmt; | 215 | use std::fmt; |
216 | 216 | ||
217 | fmt::Debug | 217 | fmt::Debug |
@@ -223,13 +223,13 @@ fmt::Debug | |||
223 | fn test_replace_add_use() { | 223 | fn test_replace_add_use() { |
224 | check_assist( | 224 | check_assist( |
225 | replace_qualified_name_with_use, | 225 | replace_qualified_name_with_use, |
226 | " | 226 | r" |
227 | use stdx; | 227 | use stdx; |
228 | 228 | ||
229 | impl std::fmt::Debug<|> for Foo { | 229 | impl std::fmt::Debug<|> for Foo { |
230 | } | 230 | } |
231 | ", | 231 | ", |
232 | " | 232 | r" |
233 | use stdx; | 233 | use stdx; |
234 | use std::fmt::Debug; | 234 | use std::fmt::Debug; |
235 | 235 | ||
@@ -243,11 +243,11 @@ impl Debug for Foo { | |||
243 | fn test_replace_file_use_other_anchor() { | 243 | fn test_replace_file_use_other_anchor() { |
244 | check_assist( | 244 | check_assist( |
245 | replace_qualified_name_with_use, | 245 | replace_qualified_name_with_use, |
246 | " | 246 | r" |
247 | impl std::fmt::Debug<|> for Foo { | 247 | impl std::fmt::Debug<|> for Foo { |
248 | } | 248 | } |
249 | ", | 249 | ", |
250 | " | 250 | r" |
251 | use std::fmt::Debug; | 251 | use std::fmt::Debug; |
252 | 252 | ||
253 | impl Debug for Foo { | 253 | impl Debug for Foo { |
@@ -260,11 +260,11 @@ impl Debug for Foo { | |||
260 | fn test_replace_add_use_other_anchor_indent() { | 260 | fn test_replace_add_use_other_anchor_indent() { |
261 | check_assist( | 261 | check_assist( |
262 | replace_qualified_name_with_use, | 262 | replace_qualified_name_with_use, |
263 | " | 263 | r" |
264 | impl std::fmt::Debug<|> for Foo { | 264 | impl std::fmt::Debug<|> for Foo { |
265 | } | 265 | } |
266 | ", | 266 | ", |
267 | " | 267 | r" |
268 | use std::fmt::Debug; | 268 | use std::fmt::Debug; |
269 | 269 | ||
270 | impl Debug for Foo { | 270 | impl Debug for Foo { |
@@ -277,13 +277,13 @@ impl Debug for Foo { | |||
277 | fn test_replace_split_different() { | 277 | fn test_replace_split_different() { |
278 | check_assist( | 278 | check_assist( |
279 | replace_qualified_name_with_use, | 279 | replace_qualified_name_with_use, |
280 | " | 280 | r" |
281 | use std::fmt; | 281 | use std::fmt; |
282 | 282 | ||
283 | impl std::io<|> for Foo { | 283 | impl std::io<|> for Foo { |
284 | } | 284 | } |
285 | ", | 285 | ", |
286 | " | 286 | r" |
287 | use std::{io, fmt}; | 287 | use std::{io, fmt}; |
288 | 288 | ||
289 | impl io for Foo { | 289 | impl io for Foo { |
@@ -296,13 +296,13 @@ impl io for Foo { | |||
296 | fn test_replace_split_self_for_use() { | 296 | fn test_replace_split_self_for_use() { |
297 | check_assist( | 297 | check_assist( |
298 | replace_qualified_name_with_use, | 298 | replace_qualified_name_with_use, |
299 | " | 299 | r" |
300 | use std::fmt; | 300 | use std::fmt; |
301 | 301 | ||
302 | impl std::fmt::Debug<|> for Foo { | 302 | impl std::fmt::Debug<|> for Foo { |
303 | } | 303 | } |
304 | ", | 304 | ", |
305 | " | 305 | r" |
306 | use std::fmt::{self, Debug, }; | 306 | use std::fmt::{self, Debug, }; |
307 | 307 | ||
308 | impl Debug for Foo { | 308 | impl Debug for Foo { |
@@ -315,13 +315,13 @@ impl Debug for Foo { | |||
315 | fn test_replace_split_self_for_target() { | 315 | fn test_replace_split_self_for_target() { |
316 | check_assist( | 316 | check_assist( |
317 | replace_qualified_name_with_use, | 317 | replace_qualified_name_with_use, |
318 | " | 318 | r" |
319 | use std::fmt::Debug; | 319 | use std::fmt::Debug; |
320 | 320 | ||
321 | impl std::fmt<|> for Foo { | 321 | impl std::fmt<|> for Foo { |
322 | } | 322 | } |
323 | ", | 323 | ", |
324 | " | 324 | r" |
325 | use std::fmt::{self, Debug}; | 325 | use std::fmt::{self, Debug}; |
326 | 326 | ||
327 | impl fmt for Foo { | 327 | impl fmt for Foo { |
@@ -334,13 +334,13 @@ impl fmt for Foo { | |||
334 | fn test_replace_add_to_nested_self_nested() { | 334 | fn test_replace_add_to_nested_self_nested() { |
335 | check_assist( | 335 | check_assist( |
336 | replace_qualified_name_with_use, | 336 | replace_qualified_name_with_use, |
337 | " | 337 | r" |
338 | use std::fmt::{Debug, nested::{Display}}; | 338 | use std::fmt::{Debug, nested::{Display}}; |
339 | 339 | ||
340 | impl std::fmt::nested<|> for Foo { | 340 | impl std::fmt::nested<|> for Foo { |
341 | } | 341 | } |
342 | ", | 342 | ", |
343 | " | 343 | r" |
344 | use std::fmt::{Debug, nested::{Display, self}}; | 344 | use std::fmt::{Debug, nested::{Display, self}}; |
345 | 345 | ||
346 | impl nested for Foo { | 346 | impl nested for Foo { |
@@ -353,13 +353,13 @@ impl nested for Foo { | |||
353 | fn test_replace_add_to_nested_self_already_included() { | 353 | fn test_replace_add_to_nested_self_already_included() { |
354 | check_assist( | 354 | check_assist( |
355 | replace_qualified_name_with_use, | 355 | replace_qualified_name_with_use, |
356 | " | 356 | r" |
357 | use std::fmt::{Debug, nested::{self, Display}}; | 357 | use std::fmt::{Debug, nested::{self, Display}}; |
358 | 358 | ||
359 | impl std::fmt::nested<|> for Foo { | 359 | impl std::fmt::nested<|> for Foo { |
360 | } | 360 | } |
361 | ", | 361 | ", |
362 | " | 362 | r" |
363 | use std::fmt::{Debug, nested::{self, Display}}; | 363 | use std::fmt::{Debug, nested::{self, Display}}; |
364 | 364 | ||
365 | impl nested for Foo { | 365 | impl nested for Foo { |
@@ -372,13 +372,13 @@ impl nested for Foo { | |||
372 | fn test_replace_add_to_nested_nested() { | 372 | fn test_replace_add_to_nested_nested() { |
373 | check_assist( | 373 | check_assist( |
374 | replace_qualified_name_with_use, | 374 | replace_qualified_name_with_use, |
375 | " | 375 | r" |
376 | use std::fmt::{Debug, nested::{Display}}; | 376 | use std::fmt::{Debug, nested::{Display}}; |
377 | 377 | ||
378 | impl std::fmt::nested::Debug<|> for Foo { | 378 | impl std::fmt::nested::Debug<|> for Foo { |
379 | } | 379 | } |
380 | ", | 380 | ", |
381 | " | 381 | r" |
382 | use std::fmt::{Debug, nested::{Display, Debug}}; | 382 | use std::fmt::{Debug, nested::{Display, Debug}}; |
383 | 383 | ||
384 | impl Debug for Foo { | 384 | impl Debug for Foo { |
@@ -391,13 +391,13 @@ impl Debug for Foo { | |||
391 | fn test_replace_split_common_target_longer() { | 391 | fn test_replace_split_common_target_longer() { |
392 | check_assist( | 392 | check_assist( |
393 | replace_qualified_name_with_use, | 393 | replace_qualified_name_with_use, |
394 | " | 394 | r" |
395 | use std::fmt::Debug; | 395 | use std::fmt::Debug; |
396 | 396 | ||
397 | impl std::fmt::nested::Display<|> for Foo { | 397 | impl std::fmt::nested::Display<|> for Foo { |
398 | } | 398 | } |
399 | ", | 399 | ", |
400 | " | 400 | r" |
401 | use std::fmt::{nested::Display, Debug}; | 401 | use std::fmt::{nested::Display, Debug}; |
402 | 402 | ||
403 | impl Display for Foo { | 403 | impl Display for Foo { |
@@ -410,13 +410,13 @@ impl Display for Foo { | |||
410 | fn test_replace_split_common_use_longer() { | 410 | fn test_replace_split_common_use_longer() { |
411 | check_assist( | 411 | check_assist( |
412 | replace_qualified_name_with_use, | 412 | replace_qualified_name_with_use, |
413 | " | 413 | r" |
414 | use std::fmt::nested::Debug; | 414 | use std::fmt::nested::Debug; |
415 | 415 | ||
416 | impl std::fmt::Display<|> for Foo { | 416 | impl std::fmt::Display<|> for Foo { |
417 | } | 417 | } |
418 | ", | 418 | ", |
419 | " | 419 | r" |
420 | use std::fmt::{Display, nested::Debug}; | 420 | use std::fmt::{Display, nested::Debug}; |
421 | 421 | ||
422 | impl Display for Foo { | 422 | impl Display for Foo { |
@@ -429,7 +429,7 @@ impl Display for Foo { | |||
429 | fn test_replace_use_nested_import() { | 429 | fn test_replace_use_nested_import() { |
430 | check_assist( | 430 | check_assist( |
431 | replace_qualified_name_with_use, | 431 | replace_qualified_name_with_use, |
432 | " | 432 | r" |
433 | use crate::{ | 433 | use crate::{ |
434 | ty::{Substs, Ty}, | 434 | ty::{Substs, Ty}, |
435 | AssocItem, | 435 | AssocItem, |
@@ -437,7 +437,7 @@ use crate::{ | |||
437 | 437 | ||
438 | fn foo() { crate::ty::lower<|>::trait_env() } | 438 | fn foo() { crate::ty::lower<|>::trait_env() } |
439 | ", | 439 | ", |
440 | " | 440 | r" |
441 | use crate::{ | 441 | use crate::{ |
442 | ty::{Substs, Ty, lower}, | 442 | ty::{Substs, Ty, lower}, |
443 | AssocItem, | 443 | AssocItem, |
@@ -452,13 +452,13 @@ fn foo() { lower::trait_env() } | |||
452 | fn test_replace_alias() { | 452 | fn test_replace_alias() { |
453 | check_assist( | 453 | check_assist( |
454 | replace_qualified_name_with_use, | 454 | replace_qualified_name_with_use, |
455 | " | 455 | r" |
456 | use std::fmt as foo; | 456 | use std::fmt as foo; |
457 | 457 | ||
458 | impl foo::Debug<|> for Foo { | 458 | impl foo::Debug<|> for Foo { |
459 | } | 459 | } |
460 | ", | 460 | ", |
461 | " | 461 | r" |
462 | use std::fmt as foo; | 462 | use std::fmt as foo; |
463 | 463 | ||
464 | impl Debug for Foo { | 464 | impl Debug for Foo { |
@@ -471,7 +471,7 @@ impl Debug for Foo { | |||
471 | fn test_replace_not_applicable_one_segment() { | 471 | fn test_replace_not_applicable_one_segment() { |
472 | check_assist_not_applicable( | 472 | check_assist_not_applicable( |
473 | replace_qualified_name_with_use, | 473 | replace_qualified_name_with_use, |
474 | " | 474 | r" |
475 | impl foo<|> for Foo { | 475 | impl foo<|> for Foo { |
476 | } | 476 | } |
477 | ", | 477 | ", |
@@ -482,7 +482,7 @@ impl foo<|> for Foo { | |||
482 | fn test_replace_not_applicable_in_use() { | 482 | fn test_replace_not_applicable_in_use() { |
483 | check_assist_not_applicable( | 483 | check_assist_not_applicable( |
484 | replace_qualified_name_with_use, | 484 | replace_qualified_name_with_use, |
485 | " | 485 | r" |
486 | use std::fmt<|>; | 486 | use std::fmt<|>; |
487 | ", | 487 | ", |
488 | ); | 488 | ); |
@@ -492,14 +492,14 @@ use std::fmt<|>; | |||
492 | fn test_replace_add_use_no_anchor_in_mod_mod() { | 492 | fn test_replace_add_use_no_anchor_in_mod_mod() { |
493 | check_assist( | 493 | check_assist( |
494 | replace_qualified_name_with_use, | 494 | replace_qualified_name_with_use, |
495 | " | 495 | r" |
496 | mod foo { | 496 | mod foo { |
497 | mod bar { | 497 | mod bar { |
498 | std::fmt::Debug<|> | 498 | std::fmt::Debug<|> |
499 | } | 499 | } |
500 | } | 500 | } |
501 | ", | 501 | ", |
502 | " | 502 | r" |
503 | mod foo { | 503 | mod foo { |
504 | mod bar { | 504 | mod bar { |
505 | use std::fmt::Debug; | 505 | use std::fmt::Debug; |
@@ -515,14 +515,14 @@ mod foo { | |||
515 | fn inserts_imports_after_inner_attributes() { | 515 | fn inserts_imports_after_inner_attributes() { |
516 | check_assist( | 516 | check_assist( |
517 | replace_qualified_name_with_use, | 517 | replace_qualified_name_with_use, |
518 | " | 518 | r" |
519 | #![allow(dead_code)] | 519 | #![allow(dead_code)] |
520 | 520 | ||
521 | fn main() { | 521 | fn main() { |
522 | std::fmt::Debug<|> | 522 | std::fmt::Debug<|> |
523 | } | 523 | } |
524 | ", | 524 | ", |
525 | " | 525 | r" |
526 | #![allow(dead_code)] | 526 | #![allow(dead_code)] |
527 | use std::fmt::Debug; | 527 | use std::fmt::Debug; |
528 | 528 | ||
@@ -537,13 +537,13 @@ fn main() { | |||
537 | fn replaces_all_affected_paths() { | 537 | fn replaces_all_affected_paths() { |
538 | check_assist( | 538 | check_assist( |
539 | replace_qualified_name_with_use, | 539 | replace_qualified_name_with_use, |
540 | " | 540 | r" |
541 | fn main() { | 541 | fn main() { |
542 | std::fmt::Debug<|>; | 542 | std::fmt::Debug<|>; |
543 | let x: std::fmt::Debug = std::fmt::Debug; | 543 | let x: std::fmt::Debug = std::fmt::Debug; |
544 | } | 544 | } |
545 | ", | 545 | ", |
546 | " | 546 | r" |
547 | use std::fmt::Debug; | 547 | use std::fmt::Debug; |
548 | 548 | ||
549 | fn main() { | 549 | fn main() { |
@@ -558,7 +558,7 @@ fn main() { | |||
558 | fn replaces_all_affected_paths_mod() { | 558 | fn replaces_all_affected_paths_mod() { |
559 | check_assist( | 559 | check_assist( |
560 | replace_qualified_name_with_use, | 560 | replace_qualified_name_with_use, |
561 | " | 561 | r" |
562 | mod m { | 562 | mod m { |
563 | fn f() { | 563 | fn f() { |
564 | std::fmt::Debug<|>; | 564 | std::fmt::Debug<|>; |
@@ -573,7 +573,7 @@ fn f() { | |||
573 | std::fmt::Debug; | 573 | std::fmt::Debug; |
574 | } | 574 | } |
575 | ", | 575 | ", |
576 | " | 576 | r" |
577 | mod m { | 577 | mod m { |
578 | use std::fmt::Debug; | 578 | use std::fmt::Debug; |
579 | 579 | ||
@@ -597,7 +597,7 @@ fn f() { | |||
597 | fn does_not_replace_in_submodules() { | 597 | fn does_not_replace_in_submodules() { |
598 | check_assist( | 598 | check_assist( |
599 | replace_qualified_name_with_use, | 599 | replace_qualified_name_with_use, |
600 | " | 600 | r" |
601 | fn main() { | 601 | fn main() { |
602 | std::fmt::Debug<|>; | 602 | std::fmt::Debug<|>; |
603 | } | 603 | } |
@@ -608,7 +608,7 @@ mod sub { | |||
608 | } | 608 | } |
609 | } | 609 | } |
610 | ", | 610 | ", |
611 | " | 611 | r" |
612 | use std::fmt::Debug; | 612 | use std::fmt::Debug; |
613 | 613 | ||
614 | fn main() { | 614 | fn main() { |
@@ -628,14 +628,14 @@ mod sub { | |||
628 | fn does_not_replace_in_use() { | 628 | fn does_not_replace_in_use() { |
629 | check_assist( | 629 | check_assist( |
630 | replace_qualified_name_with_use, | 630 | replace_qualified_name_with_use, |
631 | " | 631 | r" |
632 | use std::fmt::Display; | 632 | use std::fmt::Display; |
633 | 633 | ||
634 | fn main() { | 634 | fn main() { |
635 | std::fmt<|>; | 635 | std::fmt<|>; |
636 | } | 636 | } |
637 | ", | 637 | ", |
638 | " | 638 | r" |
639 | use std::fmt::{self, Display}; | 639 | use std::fmt::{self, Display}; |
640 | 640 | ||
641 | fn main() { | 641 | fn main() { |