aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/references
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/ide/src/references
parent171c3c08fe245938fb25321394233de5fe2abc7c (diff)
Change <|> to $0 - Rebase
Diffstat (limited to 'crates/ide/src/references')
-rw-r--r--crates/ide/src/references/rename.rs92
1 files changed, 46 insertions, 46 deletions
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index 854bf194e..53d79333c 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -493,19 +493,19 @@ mod tests {
493 493
494 #[test] 494 #[test]
495 fn test_rename_to_underscore() { 495 fn test_rename_to_underscore() {
496 check("_", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let _ = 1; }"#); 496 check("_", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let _ = 1; }"#);
497 } 497 }
498 498
499 #[test] 499 #[test]
500 fn test_rename_to_raw_identifier() { 500 fn test_rename_to_raw_identifier() {
501 check("r#fn", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let r#fn = 1; }"#); 501 check("r#fn", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let r#fn = 1; }"#);
502 } 502 }
503 503
504 #[test] 504 #[test]
505 fn test_rename_to_invalid_identifier1() { 505 fn test_rename_to_invalid_identifier1() {
506 check( 506 check(
507 "invalid!", 507 "invalid!",
508 r#"fn main() { let i<|> = 1; }"#, 508 r#"fn main() { let i$0 = 1; }"#,
509 "error: Invalid name `invalid!`: not an identifier", 509 "error: Invalid name `invalid!`: not an identifier",
510 ); 510 );
511 } 511 }
@@ -514,7 +514,7 @@ mod tests {
514 fn test_rename_to_invalid_identifier2() { 514 fn test_rename_to_invalid_identifier2() {
515 check( 515 check(
516 "multiple tokens", 516 "multiple tokens",
517 r#"fn main() { let i<|> = 1; }"#, 517 r#"fn main() { let i$0 = 1; }"#,
518 "error: Invalid name `multiple tokens`: not an identifier", 518 "error: Invalid name `multiple tokens`: not an identifier",
519 ); 519 );
520 } 520 }
@@ -523,7 +523,7 @@ mod tests {
523 fn test_rename_to_invalid_identifier3() { 523 fn test_rename_to_invalid_identifier3() {
524 check( 524 check(
525 "let", 525 "let",
526 r#"fn main() { let i<|> = 1; }"#, 526 r#"fn main() { let i$0 = 1; }"#,
527 "error: Invalid name `let`: not an identifier", 527 "error: Invalid name `let`: not an identifier",
528 ); 528 );
529 } 529 }
@@ -532,7 +532,7 @@ mod tests {
532 fn test_rename_to_invalid_identifier_lifetime() { 532 fn test_rename_to_invalid_identifier_lifetime() {
533 check( 533 check(
534 "'foo", 534 "'foo",
535 r#"fn main() { let i<|> = 1; }"#, 535 r#"fn main() { let i$0 = 1; }"#,
536 "error: Invalid name `'foo`: not an identifier", 536 "error: Invalid name `'foo`: not an identifier",
537 ); 537 );
538 } 538 }
@@ -541,7 +541,7 @@ mod tests {
541 fn test_rename_to_invalid_identifier_lifetime2() { 541 fn test_rename_to_invalid_identifier_lifetime2() {
542 check( 542 check(
543 "foo", 543 "foo",
544 r#"fn main<'a>(_: &'a<|> ()) {}"#, 544 r#"fn main<'a>(_: &'a$0 ()) {}"#,
545 "error: Invalid name `foo`: not a lifetime identifier", 545 "error: Invalid name `foo`: not a lifetime identifier",
546 ); 546 );
547 } 547 }
@@ -554,7 +554,7 @@ mod tests {
554fn main() { 554fn main() {
555 let mut i = 1; 555 let mut i = 1;
556 let j = 1; 556 let j = 1;
557 i = i<|> + j; 557 i = i$0 + j;
558 558
559 { i = 0; } 559 { i = 0; }
560 560
@@ -579,7 +579,7 @@ fn main() {
579 fn test_rename_unresolved_reference() { 579 fn test_rename_unresolved_reference() {
580 check( 580 check(
581 "new_name", 581 "new_name",
582 r#"fn main() { let _ = unresolved_ref<|>; }"#, 582 r#"fn main() { let _ = unresolved_ref$0; }"#,
583 "error: No references found at position", 583 "error: No references found at position",
584 ); 584 );
585 } 585 }
@@ -591,7 +591,7 @@ fn main() {
591 r#" 591 r#"
592macro_rules! foo {($i:ident) => {$i} } 592macro_rules! foo {($i:ident) => {$i} }
593fn main() { 593fn main() {
594 let a<|> = "test"; 594 let a$0 = "test";
595 foo!(a); 595 foo!(a);
596} 596}
597"#, 597"#,
@@ -613,7 +613,7 @@ fn main() {
613macro_rules! foo {($i:ident) => {$i} } 613macro_rules! foo {($i:ident) => {$i} }
614fn main() { 614fn main() {
615 let a = "test"; 615 let a = "test";
616 foo!(a<|>); 616 foo!(a$0);
617} 617}
618"#, 618"#,
619 r#" 619 r#"
@@ -634,7 +634,7 @@ fn main() {
634macro_rules! define_fn {($id:ident) => { fn $id{} }} 634macro_rules! define_fn {($id:ident) => { fn $id{} }}
635define_fn!(foo); 635define_fn!(foo);
636fn main() { 636fn main() {
637 fo<|>o(); 637 fo$0o();
638} 638}
639"#, 639"#,
640 r#" 640 r#"
@@ -653,7 +653,7 @@ fn main() {
653 "bar", 653 "bar",
654 r#" 654 r#"
655macro_rules! define_fn {($id:ident) => { fn $id{} }} 655macro_rules! define_fn {($id:ident) => { fn $id{} }}
656define_fn!(fo<|>o); 656define_fn!(fo$0o);
657fn main() { 657fn main() {
658 foo(); 658 foo();
659} 659}
@@ -670,17 +670,17 @@ fn main() {
670 670
671 #[test] 671 #[test]
672 fn test_rename_for_param_inside() { 672 fn test_rename_for_param_inside() {
673 check("j", r#"fn foo(i : u32) -> u32 { i<|> }"#, r#"fn foo(j : u32) -> u32 { j }"#); 673 check("j", r#"fn foo(i : u32) -> u32 { i$0 }"#, r#"fn foo(j : u32) -> u32 { j }"#);
674 } 674 }
675 675
676 #[test] 676 #[test]
677 fn test_rename_refs_for_fn_param() { 677 fn test_rename_refs_for_fn_param() {
678 check("j", r#"fn foo(i<|> : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); 678 check("j", r#"fn foo(i$0 : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#);
679 } 679 }
680 680
681 #[test] 681 #[test]
682 fn test_rename_for_mut_param() { 682 fn test_rename_for_mut_param() {
683 check("j", r#"fn foo(mut i<|> : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); 683 check("j", r#"fn foo(mut i$0 : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#);
684 } 684 }
685 685
686 #[test] 686 #[test]
@@ -688,7 +688,7 @@ fn main() {
688 check( 688 check(
689 "j", 689 "j",
690 r#" 690 r#"
691struct Foo { i<|>: i32 } 691struct Foo { i$0: i32 }
692 692
693impl Foo { 693impl Foo {
694 fn new(i: i32) -> Self { 694 fn new(i: i32) -> Self {
@@ -714,7 +714,7 @@ impl Foo {
714 check( 714 check(
715 "j", 715 "j",
716 r#" 716 r#"
717struct Foo { i<|>: i32 } 717struct Foo { i$0: i32 }
718 718
719impl Foo { 719impl Foo {
720 fn new(i: i32) -> Self { 720 fn new(i: i32) -> Self {
@@ -743,7 +743,7 @@ impl Foo {
743struct Foo { i: i32 } 743struct Foo { i: i32 }
744 744
745impl Foo { 745impl Foo {
746 fn new(i<|>: i32) -> Self { 746 fn new(i$0: i32) -> Self {
747 Self { i } 747 Self { i }
748 } 748 }
749} 749}
@@ -765,7 +765,7 @@ impl Foo {
765 check( 765 check(
766 "j", 766 "j",
767 r#" 767 r#"
768struct Foo { i<|>: i32 } 768struct Foo { i$0: i32 }
769struct Bar { i: i32 } 769struct Bar { i: i32 }
770 770
771impl Bar { 771impl Bar {
@@ -794,7 +794,7 @@ impl Bar {
794 r#" 794 r#"
795struct Foo { i: i32 } 795struct Foo { i: i32 }
796 796
797fn baz(i<|>: i32) -> Self { 797fn baz(i$0: i32) -> Self {
798 let x = Foo { i }; 798 let x = Foo { i };
799 { 799 {
800 let i = 0; 800 let i = 0;
@@ -825,7 +825,7 @@ fn baz(j: i32) -> Self {
825mod bar; 825mod bar;
826 826
827//- /bar.rs 827//- /bar.rs
828mod foo<|>; 828mod foo$0;
829 829
830//- /bar/foo.rs 830//- /bar/foo.rs
831// empty 831// empty
@@ -883,7 +883,7 @@ fn main() {}
883pub struct FooContent; 883pub struct FooContent;
884 884
885//- /bar.rs 885//- /bar.rs
886use crate::foo<|>::FooContent; 886use crate::foo$0::FooContent;
887"#, 887"#,
888 expect![[r#" 888 expect![[r#"
889 RangeInfo { 889 RangeInfo {
@@ -943,7 +943,7 @@ use crate::foo<|>::FooContent;
943 "foo2", 943 "foo2",
944 r#" 944 r#"
945//- /lib.rs 945//- /lib.rs
946mod fo<|>o; 946mod fo$0o;
947//- /foo/mod.rs 947//- /foo/mod.rs
948// emtpy 948// emtpy
949"#, 949"#,
@@ -992,7 +992,7 @@ mod fo<|>o;
992 "bar", 992 "bar",
993 r#" 993 r#"
994//- /lib.rs 994//- /lib.rs
995mod outer { mod fo<|>o; } 995mod outer { mod fo$0o; }
996 996
997//- /outer/foo.rs 997//- /outer/foo.rs
998// emtpy 998// emtpy
@@ -1041,7 +1041,7 @@ mod outer { mod fo<|>o; }
1041 check( 1041 check(
1042 "baz", 1042 "baz",
1043 r#" 1043 r#"
1044mod <|>foo { pub fn bar() {} } 1044mod $0foo { pub fn bar() {} }
1045 1045
1046fn main() { foo::bar(); } 1046fn main() { foo::bar(); }
1047"#, 1047"#,
@@ -1065,7 +1065,7 @@ fn f() {
1065} 1065}
1066 1066
1067//- /bar.rs 1067//- /bar.rs
1068pub mod foo<|>; 1068pub mod foo$0;
1069 1069
1070//- /bar/foo.rs 1070//- /bar/foo.rs
1071// pub fn fun() {} 1071// pub fn fun() {}
@@ -1128,7 +1128,7 @@ pub mod foo<|>;
1128 "Baz", 1128 "Baz",
1129 r#" 1129 r#"
1130mod foo { 1130mod foo {
1131 pub enum Foo { Bar<|> } 1131 pub enum Foo { Bar$0 }
1132} 1132}
1133 1133
1134fn func(f: foo::Foo) { 1134fn func(f: foo::Foo) {
@@ -1157,7 +1157,7 @@ fn func(f: foo::Foo) {
1157 "baz", 1157 "baz",
1158 r#" 1158 r#"
1159mod foo { 1159mod foo {
1160 pub struct Foo { pub bar<|>: uint } 1160 pub struct Foo { pub bar$0: uint }
1161} 1161}
1162 1162
1163fn foo(f: foo::Foo) { 1163fn foo(f: foo::Foo) {
@@ -1184,7 +1184,7 @@ fn foo(f: foo::Foo) {
1184struct Foo { i: i32 } 1184struct Foo { i: i32 }
1185 1185
1186impl Foo { 1186impl Foo {
1187 fn f(foo<|>: &mut Foo) -> i32 { 1187 fn f(foo$0: &mut Foo) -> i32 {
1188 foo.i 1188 foo.i
1189 } 1189 }
1190} 1190}
@@ -1205,7 +1205,7 @@ impl Foo {
1205struct Foo { i: i32 } 1205struct Foo { i: i32 }
1206 1206
1207impl Foo { 1207impl Foo {
1208 fn f(foo<|>: Foo) -> i32 { 1208 fn f(foo$0: Foo) -> i32 {
1209 foo.i 1209 foo.i
1210 } 1210 }
1211} 1211}
@@ -1229,7 +1229,7 @@ impl Foo {
1229 r#" 1229 r#"
1230struct Foo { i: i32 } 1230struct Foo { i: i32 }
1231 1231
1232fn f(foo<|>: &mut Foo) -> i32 { 1232fn f(foo$0: &mut Foo) -> i32 {
1233 foo.i 1233 foo.i
1234} 1234}
1235"#, 1235"#,
@@ -1242,7 +1242,7 @@ struct Foo { i: i32 }
1242struct Bar; 1242struct Bar;
1243 1243
1244impl Bar { 1244impl Bar {
1245 fn f(foo<|>: &mut Foo) -> i32 { 1245 fn f(foo$0: &mut Foo) -> i32 {
1246 foo.i 1246 foo.i
1247 } 1247 }
1248} 1248}
@@ -1258,7 +1258,7 @@ impl Bar {
1258 r#" 1258 r#"
1259struct Foo { i: i32 } 1259struct Foo { i: i32 }
1260impl Foo { 1260impl Foo {
1261 fn f(x: (), foo<|>: &mut Foo) -> i32 { 1261 fn f(x: (), foo$0: &mut Foo) -> i32 {
1262 foo.i 1262 foo.i
1263 } 1263 }
1264} 1264}
@@ -1274,7 +1274,7 @@ impl Foo {
1274 r#" 1274 r#"
1275struct Foo { i: i32 } 1275struct Foo { i: i32 }
1276impl &Foo { 1276impl &Foo {
1277 fn f(foo<|>: &Foo) -> i32 { 1277 fn f(foo$0: &Foo) -> i32 {
1278 foo.i 1278 foo.i
1279 } 1279 }
1280} 1280}
@@ -1298,7 +1298,7 @@ impl &Foo {
1298struct Foo { i: i32 } 1298struct Foo { i: i32 }
1299 1299
1300impl Foo { 1300impl Foo {
1301 fn f(&mut <|>self) -> i32 { 1301 fn f(&mut $0self) -> i32 {
1302 self.i 1302 self.i
1303 } 1303 }
1304} 1304}
@@ -1323,7 +1323,7 @@ impl Foo {
1323struct Foo { i: i32 } 1323struct Foo { i: i32 }
1324 1324
1325impl Foo { 1325impl Foo {
1326 fn f(<|>self) -> i32 { 1326 fn f($0self) -> i32 {
1327 self.i 1327 self.i
1328 } 1328 }
1329} 1329}
@@ -1350,7 +1350,7 @@ struct Foo { i: i32 }
1350impl Foo { 1350impl Foo {
1351 fn f(&self) -> i32 { 1351 fn f(&self) -> i32 {
1352 let self_var = 1; 1352 let self_var = 1;
1353 self<|>.i 1353 self$0.i
1354 } 1354 }
1355} 1355}
1356"#, 1356"#,
@@ -1373,7 +1373,7 @@ impl Foo {
1373 check( 1373 check(
1374 "bar", 1374 "bar",
1375 r#" 1375 r#"
1376struct Foo { i<|>: i32 } 1376struct Foo { i$0: i32 }
1377 1377
1378fn foo(bar: i32) -> Foo { 1378fn foo(bar: i32) -> Foo {
1379 Foo { i: bar } 1379 Foo { i: bar }
@@ -1394,7 +1394,7 @@ fn foo(bar: i32) -> Foo {
1394 check( 1394 check(
1395 "baz", 1395 "baz",
1396 r#" 1396 r#"
1397struct Foo { i<|>: i32 } 1397struct Foo { i$0: i32 }
1398 1398
1399fn foo(foo: Foo) { 1399fn foo(foo: Foo) {
1400 let Foo { i: baz } = foo; 1400 let Foo { i: baz } = foo;
@@ -1433,7 +1433,7 @@ struct Foo {
1433 1433
1434fn foo(foo: Foo) { 1434fn foo(foo: Foo) {
1435 let Foo { i: b } = foo; 1435 let Foo { i: b } = foo;
1436 let _ = b<|>; 1436 let _ = b$0;
1437} 1437}
1438"#, 1438"#,
1439 expected_fixture, 1439 expected_fixture,
@@ -1447,7 +1447,7 @@ struct Foo {
1447 1447
1448fn foo(foo: Foo) { 1448fn foo(foo: Foo) {
1449 let Foo { i } = foo; 1449 let Foo { i } = foo;
1450 let _ = i<|>; 1450 let _ = i$0;
1451} 1451}
1452"#, 1452"#,
1453 expected_fixture, 1453 expected_fixture,
@@ -1464,7 +1464,7 @@ struct Foo {
1464} 1464}
1465 1465
1466fn foo(Foo { i }: foo) -> i32 { 1466fn foo(Foo { i }: foo) -> i32 {
1467 i<|> 1467 i$0
1468} 1468}
1469"#, 1469"#,
1470 r#" 1470 r#"
@@ -1488,7 +1488,7 @@ trait Foo<'a> {
1488 fn foo() -> &'a (); 1488 fn foo() -> &'a ();
1489} 1489}
1490impl<'a> Foo<'a> for &'a () { 1490impl<'a> Foo<'a> for &'a () {
1491 fn foo() -> &'a<|> () { 1491 fn foo() -> &'a$0 () {
1492 unimplemented!() 1492 unimplemented!()
1493 } 1493 }
1494} 1494}
@@ -1520,7 +1520,7 @@ fn main() {
1520 let test_variable = CustomOption::Some(22); 1520 let test_variable = CustomOption::Some(22);
1521 1521
1522 match test_variable { 1522 match test_variable {
1523 CustomOption::Some(foo<|>) if foo == 11 => {} 1523 CustomOption::Some(foo$0) if foo == 11 => {}
1524 _ => (), 1524 _ => (),
1525 } 1525 }
1526}"#, 1526}"#,
@@ -1549,7 +1549,7 @@ fn main() {
1549fn foo<'a>() -> &'a () { 1549fn foo<'a>() -> &'a () {
1550 'a: { 1550 'a: {
1551 'b: loop { 1551 'b: loop {
1552 break 'a<|>; 1552 break 'a$0;
1553 } 1553 }
1554 } 1554 }
1555} 1555}