aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorKevaundray Wedderburn <[email protected]>2021-01-06 20:15:48 +0000
committerKevaundray Wedderburn <[email protected]>2021-01-07 12:09:23 +0000
commit72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (patch)
treec138363e3592c690d841aeedb9ac97d6b2ff4396 /crates/hir_def/src
parent171c3c08fe245938fb25321394233de5fe2abc7c (diff)
Change <|> to $0 - Rebase
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/body/scope.rs30
-rw-r--r--crates/hir_def/src/find_path.rs48
-rw-r--r--crates/hir_def/src/nameres/tests/incremental.rs4
3 files changed, 41 insertions, 41 deletions
diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs
index 9142bc05b..065785da7 100644
--- a/crates/hir_def/src/body/scope.rs
+++ b/crates/hir_def/src/body/scope.rs
@@ -194,7 +194,7 @@ mod tests {
194 let mut buf = String::new(); 194 let mut buf = String::new();
195 let off: usize = offset.into(); 195 let off: usize = offset.into();
196 buf.push_str(&code[..off]); 196 buf.push_str(&code[..off]);
197 buf.push_str("<|>marker"); 197 buf.push_str("$0marker");
198 buf.push_str(&code[off..]); 198 buf.push_str(&code[off..]);
199 buf 199 buf
200 }; 200 };
@@ -231,7 +231,7 @@ mod tests {
231 r" 231 r"
232 fn quux(foo: i32) { 232 fn quux(foo: i32) {
233 let f = |bar, baz: i32| { 233 let f = |bar, baz: i32| {
234 <|> 234 $0
235 }; 235 };
236 }", 236 }",
237 &["bar", "baz", "foo"], 237 &["bar", "baz", "foo"],
@@ -243,7 +243,7 @@ mod tests {
243 do_check( 243 do_check(
244 r" 244 r"
245 fn quux() { 245 fn quux() {
246 f(|x| <|> ); 246 f(|x| $0 );
247 }", 247 }",
248 &["x"], 248 &["x"],
249 ); 249 );
@@ -254,7 +254,7 @@ mod tests {
254 do_check( 254 do_check(
255 r" 255 r"
256 fn quux() { 256 fn quux() {
257 z.f(|x| <|> ); 257 z.f(|x| $0 );
258 }", 258 }",
259 &["x"], 259 &["x"],
260 ); 260 );
@@ -267,7 +267,7 @@ mod tests {
267 fn quux() { 267 fn quux() {
268 loop { 268 loop {
269 let x = (); 269 let x = ();
270 <|> 270 $0
271 }; 271 };
272 }", 272 }",
273 &["x"], 273 &["x"],
@@ -281,7 +281,7 @@ mod tests {
281 fn quux() { 281 fn quux() {
282 match () { 282 match () {
283 Some(x) => { 283 Some(x) => {
284 <|> 284 $0
285 } 285 }
286 }; 286 };
287 }", 287 }",
@@ -294,7 +294,7 @@ mod tests {
294 do_check( 294 do_check(
295 r" 295 r"
296 fn foo(x: String) { 296 fn foo(x: String) {
297 let x : &str = &x<|>; 297 let x : &str = &x$0;
298 }", 298 }",
299 &["x"], 299 &["x"],
300 ); 300 );
@@ -307,7 +307,7 @@ mod tests {
307fn foo() { 307fn foo() {
308 match Some(()) { 308 match Some(()) {
309 opt @ Some(unit) => { 309 opt @ Some(unit) => {
310 <|> 310 $0
311 } 311 }
312 _ => {} 312 _ => {}
313 } 313 }
@@ -330,7 +330,7 @@ fn foo() {
330 330
331 fn foo() { 331 fn foo() {
332 mac!(); 332 mac!();
333 <|> 333 $0
334 } 334 }
335 ", 335 ",
336 &[], 336 &[],
@@ -343,7 +343,7 @@ fn foo() {
343 r" 343 r"
344 fn foo() { 344 fn foo() {
345 trait {} 345 trait {}
346 <|> 346 $0
347 } 347 }
348 ", 348 ",
349 &[], 349 &[],
@@ -391,7 +391,7 @@ fn foo(x: i32, y: u32) {
391 let z = x * 2; 391 let z = x * 2;
392 } 392 }
393 { 393 {
394 let t = x<|> * 3; 394 let t = x$0 * 3;
395 } 395 }
396} 396}
397"#, 397"#,
@@ -404,7 +404,7 @@ fn foo(x: i32, y: u32) {
404 do_check_local_name( 404 do_check_local_name(
405 r#" 405 r#"
406fn foo(x: String) { 406fn foo(x: String) {
407 let x : &str = &x<|>; 407 let x : &str = &x$0;
408} 408}
409"#, 409"#,
410 7, 410 7,
@@ -417,7 +417,7 @@ fn foo(x: String) {
417 r" 417 r"
418fn foo(x: String) { 418fn foo(x: String) {
419 let x : &str = &x; 419 let x : &str = &x;
420 x<|> 420 x$0
421} 421}
422", 422",
423 28, 423 28,
@@ -430,7 +430,7 @@ fn foo(x: String) {
430 r" 430 r"
431fn foo() { 431fn foo() {
432 if let Some(&from) = bar() { 432 if let Some(&from) = bar() {
433 from<|>; 433 from$0;
434 } 434 }
435} 435}
436", 436",
@@ -446,7 +446,7 @@ fn foo() {
446fn test() { 446fn test() {
447 let foo: Option<f32> = None; 447 let foo: Option<f32> = None;
448 while let Option::Some(spam) = foo { 448 while let Option::Some(spam) = foo {
449 spam<|> 449 spam$0
450 } 450 }
451} 451}
452"#, 452"#,
diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs
index 02613c4c4..4a212d291 100644
--- a/crates/hir_def/src/find_path.rs
+++ b/crates/hir_def/src/find_path.rs
@@ -410,7 +410,7 @@ mod tests {
410 let code = r#" 410 let code = r#"
411 //- /main.rs 411 //- /main.rs
412 struct S; 412 struct S;
413 <|> 413 $0
414 "#; 414 "#;
415 check_found_path(code, "S", "S", "crate::S", "self::S"); 415 check_found_path(code, "S", "S", "crate::S", "self::S");
416 } 416 }
@@ -420,7 +420,7 @@ mod tests {
420 let code = r#" 420 let code = r#"
421 //- /main.rs 421 //- /main.rs
422 enum E { A } 422 enum E { A }
423 <|> 423 $0
424 "#; 424 "#;
425 check_found_path(code, "E::A", "E::A", "E::A", "E::A"); 425 check_found_path(code, "E::A", "E::A", "E::A", "E::A");
426 } 426 }
@@ -432,7 +432,7 @@ mod tests {
432 mod foo { 432 mod foo {
433 pub struct S; 433 pub struct S;
434 } 434 }
435 <|> 435 $0
436 "#; 436 "#;
437 check_found_path(code, "foo::S", "foo::S", "crate::foo::S", "self::foo::S"); 437 check_found_path(code, "foo::S", "foo::S", "crate::foo::S", "self::foo::S");
438 } 438 }
@@ -446,7 +446,7 @@ mod tests {
446 mod bar; 446 mod bar;
447 struct S; 447 struct S;
448 //- /foo/bar.rs 448 //- /foo/bar.rs
449 <|> 449 $0
450 "#; 450 "#;
451 check_found_path(code, "super::S", "super::S", "crate::foo::S", "super::S"); 451 check_found_path(code, "super::S", "super::S", "crate::foo::S", "super::S");
452 } 452 }
@@ -457,7 +457,7 @@ mod tests {
457 //- /main.rs 457 //- /main.rs
458 mod foo; 458 mod foo;
459 //- /foo.rs 459 //- /foo.rs
460 <|> 460 $0
461 "#; 461 "#;
462 check_found_path(code, "self", "self", "crate::foo", "self"); 462 check_found_path(code, "self", "self", "crate::foo", "self");
463 } 463 }
@@ -468,7 +468,7 @@ mod tests {
468 //- /main.rs 468 //- /main.rs
469 mod foo; 469 mod foo;
470 //- /foo.rs 470 //- /foo.rs
471 <|> 471 $0
472 "#; 472 "#;
473 check_found_path(code, "crate", "crate", "crate", "crate"); 473 check_found_path(code, "crate", "crate", "crate", "crate");
474 } 474 }
@@ -480,7 +480,7 @@ mod tests {
480 mod foo; 480 mod foo;
481 struct S; 481 struct S;
482 //- /foo.rs 482 //- /foo.rs
483 <|> 483 $0
484 "#; 484 "#;
485 check_found_path(code, "crate::S", "crate::S", "crate::S", "crate::S"); 485 check_found_path(code, "crate::S", "crate::S", "crate::S", "crate::S");
486 } 486 }
@@ -489,7 +489,7 @@ mod tests {
489 fn different_crate() { 489 fn different_crate() {
490 let code = r#" 490 let code = r#"
491 //- /main.rs crate:main deps:std 491 //- /main.rs crate:main deps:std
492 <|> 492 $0
493 //- /std.rs crate:std 493 //- /std.rs crate:std
494 pub struct S; 494 pub struct S;
495 "#; 495 "#;
@@ -501,7 +501,7 @@ mod tests {
501 let code = r#" 501 let code = r#"
502 //- /main.rs crate:main deps:std 502 //- /main.rs crate:main deps:std
503 extern crate std as std_renamed; 503 extern crate std as std_renamed;
504 <|> 504 $0
505 //- /std.rs crate:std 505 //- /std.rs crate:std
506 pub struct S; 506 pub struct S;
507 "#; 507 "#;
@@ -523,7 +523,7 @@ mod tests {
523 //- /main.rs crate:main deps:syntax 523 //- /main.rs crate:main deps:syntax
524 524
525 use syntax::ast; 525 use syntax::ast;
526 <|> 526 $0
527 527
528 //- /lib.rs crate:syntax 528 //- /lib.rs crate:syntax
529 pub mod ast { 529 pub mod ast {
@@ -543,7 +543,7 @@ mod tests {
543 let code = r#" 543 let code = r#"
544 //- /main.rs crate:main deps:syntax 544 //- /main.rs crate:main deps:syntax
545 545
546 <|> 546 $0
547 547
548 //- /lib.rs crate:syntax 548 //- /lib.rs crate:syntax
549 pub mod ast { 549 pub mod ast {
@@ -569,7 +569,7 @@ mod tests {
569 mod foo { pub(super) struct S; } 569 mod foo { pub(super) struct S; }
570 pub(crate) use foo::*; 570 pub(crate) use foo::*;
571 } 571 }
572 <|> 572 $0
573 "#; 573 "#;
574 check_found_path(code, "bar::S", "bar::S", "crate::bar::S", "self::bar::S"); 574 check_found_path(code, "bar::S", "bar::S", "crate::bar::S", "self::bar::S");
575 } 575 }
@@ -582,7 +582,7 @@ mod tests {
582 mod foo { pub(super) struct S; } 582 mod foo { pub(super) struct S; }
583 pub(crate) use foo::S as U; 583 pub(crate) use foo::S as U;
584 } 584 }
585 <|> 585 $0
586 "#; 586 "#;
587 check_found_path(code, "bar::U", "bar::U", "crate::bar::U", "self::bar::U"); 587 check_found_path(code, "bar::U", "bar::U", "crate::bar::U", "self::bar::U");
588 } 588 }
@@ -591,7 +591,7 @@ mod tests {
591 fn different_crate_reexport() { 591 fn different_crate_reexport() {
592 let code = r#" 592 let code = r#"
593 //- /main.rs crate:main deps:std 593 //- /main.rs crate:main deps:std
594 <|> 594 $0
595 //- /std.rs crate:std deps:core 595 //- /std.rs crate:std deps:core
596 pub use core::S; 596 pub use core::S;
597 //- /core.rs crate:core 597 //- /core.rs crate:core
@@ -604,7 +604,7 @@ mod tests {
604 fn prelude() { 604 fn prelude() {
605 let code = r#" 605 let code = r#"
606 //- /main.rs crate:main deps:std 606 //- /main.rs crate:main deps:std
607 <|> 607 $0
608 //- /std.rs crate:std 608 //- /std.rs crate:std
609 pub mod prelude { pub struct S; } 609 pub mod prelude { pub struct S; }
610 #[prelude_import] 610 #[prelude_import]
@@ -617,7 +617,7 @@ mod tests {
617 fn enum_variant_from_prelude() { 617 fn enum_variant_from_prelude() {
618 let code = r#" 618 let code = r#"
619 //- /main.rs crate:main deps:std 619 //- /main.rs crate:main deps:std
620 <|> 620 $0
621 //- /std.rs crate:std 621 //- /std.rs crate:std
622 pub mod prelude { 622 pub mod prelude {
623 pub enum Option<T> { Some(T), None } 623 pub enum Option<T> { Some(T), None }
@@ -637,7 +637,7 @@ mod tests {
637 pub mod foo; 637 pub mod foo;
638 pub mod baz; 638 pub mod baz;
639 struct S; 639 struct S;
640 <|> 640 $0
641 //- /foo.rs 641 //- /foo.rs
642 pub mod bar { pub struct S; } 642 pub mod bar { pub struct S; }
643 //- /baz.rs 643 //- /baz.rs
@@ -654,7 +654,7 @@ mod tests {
654 pub mod bar { pub struct S; } 654 pub mod bar { pub struct S; }
655 use bar::S; 655 use bar::S;
656 //- /foo.rs 656 //- /foo.rs
657 <|> 657 $0
658 "#; 658 "#;
659 // crate::S would be shorter, but using private imports seems wrong 659 // crate::S would be shorter, but using private imports seems wrong
660 check_found_path(code, "crate::bar::S", "crate::bar::S", "crate::bar::S", "crate::bar::S"); 660 check_found_path(code, "crate::bar::S", "crate::bar::S", "crate::bar::S", "crate::bar::S");
@@ -668,7 +668,7 @@ mod tests {
668 pub mod bar; 668 pub mod bar;
669 pub mod baz; 669 pub mod baz;
670 //- /bar.rs 670 //- /bar.rs
671 <|> 671 $0
672 //- /foo.rs 672 //- /foo.rs
673 pub use super::baz; 673 pub use super::baz;
674 pub struct S; 674 pub struct S;
@@ -683,7 +683,7 @@ mod tests {
683 mark::check!(prefer_std_paths); 683 mark::check!(prefer_std_paths);
684 let code = r#" 684 let code = r#"
685 //- /main.rs crate:main deps:alloc,std 685 //- /main.rs crate:main deps:alloc,std
686 <|> 686 $0
687 687
688 //- /std.rs crate:std deps:alloc 688 //- /std.rs crate:std deps:alloc
689 pub mod sync { 689 pub mod sync {
@@ -711,7 +711,7 @@ mod tests {
711 //- /main.rs crate:main deps:core,std 711 //- /main.rs crate:main deps:core,std
712 #![no_std] 712 #![no_std]
713 713
714 <|> 714 $0
715 715
716 //- /std.rs crate:std deps:core 716 //- /std.rs crate:std deps:core
717 717
@@ -740,7 +740,7 @@ mod tests {
740 //- /main.rs crate:main deps:alloc,std 740 //- /main.rs crate:main deps:alloc,std
741 #![no_std] 741 #![no_std]
742 742
743 <|> 743 $0
744 744
745 //- /std.rs crate:std deps:alloc 745 //- /std.rs crate:std deps:alloc
746 746
@@ -767,7 +767,7 @@ mod tests {
767 fn prefer_shorter_paths_if_not_alloc() { 767 fn prefer_shorter_paths_if_not_alloc() {
768 let code = r#" 768 let code = r#"
769 //- /main.rs crate:main deps:megaalloc,std 769 //- /main.rs crate:main deps:megaalloc,std
770 <|> 770 $0
771 771
772 //- /std.rs crate:std deps:megaalloc 772 //- /std.rs crate:std deps:megaalloc
773 pub mod sync { 773 pub mod sync {
@@ -790,7 +790,7 @@ mod tests {
790 fn builtins_are_in_scope() { 790 fn builtins_are_in_scope() {
791 let code = r#" 791 let code = r#"
792 //- /main.rs 792 //- /main.rs
793 <|> 793 $0
794 794
795 pub mod primitive { 795 pub mod primitive {
796 pub use u8; 796 pub use u8;
diff --git a/crates/hir_def/src/nameres/tests/incremental.rs b/crates/hir_def/src/nameres/tests/incremental.rs
index 8981fa7c9..509e1bbbc 100644
--- a/crates/hir_def/src/nameres/tests/incremental.rs
+++ b/crates/hir_def/src/nameres/tests/incremental.rs
@@ -28,7 +28,7 @@ fn typing_inside_a_function_should_not_invalidate_def_map() {
28 check_def_map_is_not_recomputed( 28 check_def_map_is_not_recomputed(
29 r" 29 r"
30 //- /lib.rs 30 //- /lib.rs
31 mod foo;<|> 31 mod foo;$0
32 32
33 use crate::foo::bar::Baz; 33 use crate::foo::bar::Baz;
34 34
@@ -81,7 +81,7 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() {
81 pub mod bar; 81 pub mod bar;
82 82
83 //- /foo/bar.rs 83 //- /foo/bar.rs
84 <|> 84 $0
85 m!(X); 85 m!(X);
86 ", 86 ",
87 ); 87 );