aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-06-15 21:39:26 +0100
committerJonas Schievink <[email protected]>2020-06-15 21:39:26 +0100
commit71c002e58947a7e19d2ba4bc41336618a087824b (patch)
tree914243a11ab07d07f5dbbac788460c6ec2461426 /crates
parent5d66bfe16343141132c8a7aefa727b209ec3e66a (diff)
It's fookin' raw
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs96
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"
156std::fmt::Debug<|> 156std::fmt::Debug<|>
157 ", 157 ",
158 " 158 r"
159use std::fmt::Debug; 159use std::fmt::Debug;
160 160
161Debug 161Debug
@@ -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"
170std::fmt::Debug<|> 170std::fmt::Debug<|>
171 171
172fn main() { 172fn main() {
173} 173}
174 ", 174 ",
175 " 175 r"
176use std::fmt::Debug; 176use std::fmt::Debug;
177 177
178Debug 178Debug
@@ -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"
191fn main() { 191fn main() {
192} 192}
193 193
194std::fmt::Debug<|> 194std::fmt::Debug<|>
195 ", 195 ",
196 " 196 r"
197use std::fmt::Debug; 197use std::fmt::Debug;
198 198
199fn main() { 199fn 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"
212std::fmt<|>::Debug 212std::fmt<|>::Debug
213 ", 213 ",
214 " 214 r"
215use std::fmt; 215use std::fmt;
216 216
217fmt::Debug 217fmt::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"
227use stdx; 227use stdx;
228 228
229impl std::fmt::Debug<|> for Foo { 229impl std::fmt::Debug<|> for Foo {
230} 230}
231 ", 231 ",
232 " 232 r"
233use stdx; 233use stdx;
234use std::fmt::Debug; 234use 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"
247impl std::fmt::Debug<|> for Foo { 247impl std::fmt::Debug<|> for Foo {
248} 248}
249 ", 249 ",
250 " 250 r"
251use std::fmt::Debug; 251use std::fmt::Debug;
252 252
253impl Debug for Foo { 253impl 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"
281use std::fmt; 281use std::fmt;
282 282
283impl std::io<|> for Foo { 283impl std::io<|> for Foo {
284} 284}
285 ", 285 ",
286 " 286 r"
287use std::{io, fmt}; 287use std::{io, fmt};
288 288
289impl io for Foo { 289impl 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"
300use std::fmt; 300use std::fmt;
301 301
302impl std::fmt::Debug<|> for Foo { 302impl std::fmt::Debug<|> for Foo {
303} 303}
304 ", 304 ",
305 " 305 r"
306use std::fmt::{self, Debug, }; 306use std::fmt::{self, Debug, };
307 307
308impl Debug for Foo { 308impl 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"
319use std::fmt::Debug; 319use std::fmt::Debug;
320 320
321impl std::fmt<|> for Foo { 321impl std::fmt<|> for Foo {
322} 322}
323 ", 323 ",
324 " 324 r"
325use std::fmt::{self, Debug}; 325use std::fmt::{self, Debug};
326 326
327impl fmt for Foo { 327impl 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"
338use std::fmt::{Debug, nested::{Display}}; 338use std::fmt::{Debug, nested::{Display}};
339 339
340impl std::fmt::nested<|> for Foo { 340impl std::fmt::nested<|> for Foo {
341} 341}
342", 342",
343 " 343 r"
344use std::fmt::{Debug, nested::{Display, self}}; 344use std::fmt::{Debug, nested::{Display, self}};
345 345
346impl nested for Foo { 346impl 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"
357use std::fmt::{Debug, nested::{self, Display}}; 357use std::fmt::{Debug, nested::{self, Display}};
358 358
359impl std::fmt::nested<|> for Foo { 359impl std::fmt::nested<|> for Foo {
360} 360}
361", 361",
362 " 362 r"
363use std::fmt::{Debug, nested::{self, Display}}; 363use std::fmt::{Debug, nested::{self, Display}};
364 364
365impl nested for Foo { 365impl 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"
376use std::fmt::{Debug, nested::{Display}}; 376use std::fmt::{Debug, nested::{Display}};
377 377
378impl std::fmt::nested::Debug<|> for Foo { 378impl std::fmt::nested::Debug<|> for Foo {
379} 379}
380", 380",
381 " 381 r"
382use std::fmt::{Debug, nested::{Display, Debug}}; 382use std::fmt::{Debug, nested::{Display, Debug}};
383 383
384impl Debug for Foo { 384impl 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"
395use std::fmt::Debug; 395use std::fmt::Debug;
396 396
397impl std::fmt::nested::Display<|> for Foo { 397impl std::fmt::nested::Display<|> for Foo {
398} 398}
399", 399",
400 " 400 r"
401use std::fmt::{nested::Display, Debug}; 401use std::fmt::{nested::Display, Debug};
402 402
403impl Display for Foo { 403impl 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"
414use std::fmt::nested::Debug; 414use std::fmt::nested::Debug;
415 415
416impl std::fmt::Display<|> for Foo { 416impl std::fmt::Display<|> for Foo {
417} 417}
418", 418",
419 " 419 r"
420use std::fmt::{Display, nested::Debug}; 420use std::fmt::{Display, nested::Debug};
421 421
422impl Display for Foo { 422impl 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"
433use crate::{ 433use crate::{
434 ty::{Substs, Ty}, 434 ty::{Substs, Ty},
435 AssocItem, 435 AssocItem,
@@ -437,7 +437,7 @@ use crate::{
437 437
438fn foo() { crate::ty::lower<|>::trait_env() } 438fn foo() { crate::ty::lower<|>::trait_env() }
439", 439",
440 " 440 r"
441use crate::{ 441use 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"
456use std::fmt as foo; 456use std::fmt as foo;
457 457
458impl foo::Debug<|> for Foo { 458impl foo::Debug<|> for Foo {
459} 459}
460", 460",
461 " 461 r"
462use std::fmt as foo; 462use std::fmt as foo;
463 463
464impl Debug for Foo { 464impl 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"
475impl foo<|> for Foo { 475impl 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"
486use std::fmt<|>; 486use 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"
496mod foo { 496mod foo {
497 mod bar { 497 mod bar {
498 std::fmt::Debug<|> 498 std::fmt::Debug<|>
499 } 499 }
500} 500}
501 ", 501 ",
502 " 502 r"
503mod foo { 503mod 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
521fn main() { 521fn main() {
522 std::fmt::Debug<|> 522 std::fmt::Debug<|>
523} 523}
524 ", 524 ",
525 " 525 r"
526#![allow(dead_code)] 526#![allow(dead_code)]
527use std::fmt::Debug; 527use 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"
541fn main() { 541fn 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"
547use std::fmt::Debug; 547use std::fmt::Debug;
548 548
549fn main() { 549fn 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"
562mod m { 562mod 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"
577mod m { 577mod 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"
601fn main() { 601fn 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"
612use std::fmt::Debug; 612use std::fmt::Debug;
613 613
614fn main() { 614fn 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"
632use std::fmt::Display; 632use std::fmt::Display;
633 633
634fn main() { 634fn main() {
635 std::fmt<|>; 635 std::fmt<|>;
636} 636}
637 ", 637 ",
638 " 638 r"
639use std::fmt::{self, Display}; 639use std::fmt::{self, Display};
640 640
641fn main() { 641fn main() {