aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-06 08:57:00 +0100
committerBenjamin Coenen <[email protected]>2020-05-06 08:57:00 +0100
commitc4d128e454448191c4b21d8e151c673e4c42376e (patch)
tree17cf5bbf429642c52708cd0d3c1d8885b63543f0 /crates/ra_ide/src/references
parent0bf02f5ccac99c91f10ef46bb06ff2ea316c382c (diff)
parent30eb458b4fa8adcecd8cbf731bd1cfa9a7a8b88b (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into fix_4311
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r--crates/ra_ide/src/references/rename.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 916edaef2..0398d53bc 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -122,7 +122,7 @@ fn rename_mod(
122 source_file_edits.extend(ref_edits); 122 source_file_edits.extend(ref_edits);
123 } 123 }
124 124
125 Some(SourceChange::from_edits("rename", source_file_edits, file_system_edits)) 125 Some(SourceChange::from_edits("Rename", source_file_edits, file_system_edits))
126} 126}
127 127
128fn rename_reference( 128fn rename_reference(
@@ -141,7 +141,7 @@ fn rename_reference(
141 return None; 141 return None;
142 } 142 }
143 143
144 Some(RangeInfo::new(range, SourceChange::source_file_edits("rename", edit))) 144 Some(RangeInfo::new(range, SourceChange::source_file_edits("Rename", edit)))
145} 145}
146 146
147#[cfg(test)] 147#[cfg(test)]
@@ -530,17 +530,17 @@ mod tests {
530 RangeInfo { 530 RangeInfo {
531 range: 4..7, 531 range: 4..7,
532 info: SourceChange { 532 info: SourceChange {
533 label: "rename", 533 label: "Rename",
534 source_file_edits: [ 534 source_file_edits: [
535 SourceFileEdit { 535 SourceFileEdit {
536 file_id: FileId( 536 file_id: FileId(
537 2, 537 2,
538 ), 538 ),
539 edit: TextEdit { 539 edit: TextEdit {
540 atoms: [ 540 indels: [
541 AtomTextEdit { 541 Indel {
542 delete: 4..7,
543 insert: "foo2", 542 insert: "foo2",
543 delete: 4..7,
544 }, 544 },
545 ], 545 ],
546 }, 546 },
@@ -582,17 +582,17 @@ mod tests {
582 RangeInfo { 582 RangeInfo {
583 range: 4..7, 583 range: 4..7,
584 info: SourceChange { 584 info: SourceChange {
585 label: "rename", 585 label: "Rename",
586 source_file_edits: [ 586 source_file_edits: [
587 SourceFileEdit { 587 SourceFileEdit {
588 file_id: FileId( 588 file_id: FileId(
589 1, 589 1,
590 ), 590 ),
591 edit: TextEdit { 591 edit: TextEdit {
592 atoms: [ 592 indels: [
593 AtomTextEdit { 593 Indel {
594 delete: 4..7,
595 insert: "foo2", 594 insert: "foo2",
595 delete: 4..7,
596 }, 596 },
597 ], 597 ],
598 }, 598 },
@@ -665,17 +665,17 @@ mod tests {
665 RangeInfo { 665 RangeInfo {
666 range: 8..11, 666 range: 8..11,
667 info: SourceChange { 667 info: SourceChange {
668 label: "rename", 668 label: "Rename",
669 source_file_edits: [ 669 source_file_edits: [
670 SourceFileEdit { 670 SourceFileEdit {
671 file_id: FileId( 671 file_id: FileId(
672 2, 672 2,
673 ), 673 ),
674 edit: TextEdit { 674 edit: TextEdit {
675 atoms: [ 675 indels: [
676 AtomTextEdit { 676 Indel {
677 delete: 8..11,
678 insert: "foo2", 677 insert: "foo2",
678 delete: 8..11,
679 }, 679 },
680 ], 680 ],
681 }, 681 },
@@ -685,10 +685,10 @@ mod tests {
685 1, 685 1,
686 ), 686 ),
687 edit: TextEdit { 687 edit: TextEdit {
688 atoms: [ 688 indels: [
689 AtomTextEdit { 689 Indel {
690 delete: 27..30,
691 insert: "foo2", 690 insert: "foo2",
691 delete: 27..30,
692 }, 692 },
693 ], 693 ],
694 }, 694 },
@@ -720,13 +720,13 @@ mod tests {
720 if let Some(change) = source_change { 720 if let Some(change) = source_change {
721 for edit in change.info.source_file_edits { 721 for edit in change.info.source_file_edits {
722 file_id = Some(edit.file_id); 722 file_id = Some(edit.file_id);
723 for atom in edit.edit.as_atoms() { 723 for indel in edit.edit.as_indels() {
724 text_edit_builder.replace(atom.delete, atom.insert.clone()); 724 text_edit_builder.replace(indel.delete, indel.insert.clone());
725 } 725 }
726 } 726 }
727 } 727 }
728 let result = 728 let mut result = analysis.file_text(file_id.unwrap()).unwrap().to_string();
729 text_edit_builder.finish().apply(&*analysis.file_text(file_id.unwrap()).unwrap()); 729 text_edit_builder.finish().apply(&mut result);
730 assert_eq_text!(expected, &*result); 730 assert_eq_text!(expected, &*result);
731 } 731 }
732} 732}