aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-25 11:16:02 +0100
committerGitHub <[email protected]>2020-04-25 11:16:02 +0100
commit29fc409e7fe5b12dcf6bfbcca622d79c4c8fcb72 (patch)
treee42f7bd1490bca66e0786d5bf2b3194aeaa57a93 /crates/ra_ide/src/references
parent27a7718880d93f55f905da606d108d3b3c682ab4 (diff)
parente87346950039a54c3f0b02d6056cbb92ca38eb28 (diff)
Merge #4131
4131: Switch to text-size r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r--crates/ra_ide/src/references/rename.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 9acc6158a..a8f320e2f 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -54,15 +54,12 @@ fn source_edit_from_reference(reference: Reference, new_name: &str) -> SourceFil
54 ReferenceKind::StructFieldShorthandForField => { 54 ReferenceKind::StructFieldShorthandForField => {
55 replacement_text.push_str(new_name); 55 replacement_text.push_str(new_name);
56 replacement_text.push_str(": "); 56 replacement_text.push_str(": ");
57 TextRange::from_to( 57 TextRange::new(reference.file_range.range.start(), reference.file_range.range.start())
58 reference.file_range.range.start(),
59 reference.file_range.range.start(),
60 )
61 } 58 }
62 ReferenceKind::StructFieldShorthandForLocal => { 59 ReferenceKind::StructFieldShorthandForLocal => {
63 replacement_text.push_str(": "); 60 replacement_text.push_str(": ");
64 replacement_text.push_str(new_name); 61 replacement_text.push_str(new_name);
65 TextRange::from_to(reference.file_range.range.end(), reference.file_range.range.end()) 62 TextRange::new(reference.file_range.range.end(), reference.file_range.range.end())
66 } 63 }
67 _ => { 64 _ => {
68 replacement_text.push_str(new_name); 65 replacement_text.push_str(new_name);
@@ -528,7 +525,7 @@ mod tests {
528@r###" 525@r###"
529 Some( 526 Some(
530 RangeInfo { 527 RangeInfo {
531 range: [4; 7), 528 range: 4..7,
532 info: SourceChange { 529 info: SourceChange {
533 label: "rename", 530 label: "rename",
534 source_file_edits: [ 531 source_file_edits: [
@@ -539,7 +536,7 @@ mod tests {
539 edit: TextEdit { 536 edit: TextEdit {
540 atoms: [ 537 atoms: [
541 AtomTextEdit { 538 AtomTextEdit {
542 delete: [4; 7), 539 delete: 4..7,
543 insert: "foo2", 540 insert: "foo2",
544 }, 541 },
545 ], 542 ],
@@ -580,7 +577,7 @@ mod tests {
580 @r###" 577 @r###"
581 Some( 578 Some(
582 RangeInfo { 579 RangeInfo {
583 range: [4; 7), 580 range: 4..7,
584 info: SourceChange { 581 info: SourceChange {
585 label: "rename", 582 label: "rename",
586 source_file_edits: [ 583 source_file_edits: [
@@ -591,7 +588,7 @@ mod tests {
591 edit: TextEdit { 588 edit: TextEdit {
592 atoms: [ 589 atoms: [
593 AtomTextEdit { 590 AtomTextEdit {
594 delete: [4; 7), 591 delete: 4..7,
595 insert: "foo2", 592 insert: "foo2",
596 }, 593 },
597 ], 594 ],
@@ -663,7 +660,7 @@ mod tests {
663@r###" 660@r###"
664 Some( 661 Some(
665 RangeInfo { 662 RangeInfo {
666 range: [8; 11), 663 range: 8..11,
667 info: SourceChange { 664 info: SourceChange {
668 label: "rename", 665 label: "rename",
669 source_file_edits: [ 666 source_file_edits: [
@@ -674,7 +671,7 @@ mod tests {
674 edit: TextEdit { 671 edit: TextEdit {
675 atoms: [ 672 atoms: [
676 AtomTextEdit { 673 AtomTextEdit {
677 delete: [8; 11), 674 delete: 8..11,
678 insert: "foo2", 675 insert: "foo2",
679 }, 676 },
680 ], 677 ],
@@ -687,7 +684,7 @@ mod tests {
687 edit: TextEdit { 684 edit: TextEdit {
688 atoms: [ 685 atoms: [
689 AtomTextEdit { 686 AtomTextEdit {
690 delete: [27; 30), 687 delete: 27..30,
691 insert: "foo2", 688 insert: "foo2",
692 }, 689 },
693 ], 690 ],