aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references/rename.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/references/rename.rs')
-rw-r--r--crates/ra_ide/src/references/rename.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 410dae75c..fd2163dad 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -9,7 +9,7 @@ use ra_syntax::{
9}; 9};
10use ra_text_edit::TextEdit; 10use ra_text_edit::TextEdit;
11use std::convert::TryInto; 11use std::convert::TryInto;
12use test_utils::tested_by; 12use test_utils::mark;
13 13
14use crate::{ 14use crate::{
15 references::find_all_refs, FilePosition, FileSystemEdit, RangeInfo, Reference, ReferenceKind, 15 references::find_all_refs, FilePosition, FileSystemEdit, RangeInfo, Reference, ReferenceKind,
@@ -57,13 +57,13 @@ fn source_edit_from_reference(reference: Reference, new_name: &str) -> SourceFil
57 let file_id = reference.file_range.file_id; 57 let file_id = reference.file_range.file_id;
58 let range = match reference.kind { 58 let range = match reference.kind {
59 ReferenceKind::FieldShorthandForField => { 59 ReferenceKind::FieldShorthandForField => {
60 tested_by!(test_rename_struct_field_for_shorthand); 60 mark::hit!(test_rename_struct_field_for_shorthand);
61 replacement_text.push_str(new_name); 61 replacement_text.push_str(new_name);
62 replacement_text.push_str(": "); 62 replacement_text.push_str(": ");
63 TextRange::new(reference.file_range.range.start(), reference.file_range.range.start()) 63 TextRange::new(reference.file_range.range.start(), reference.file_range.range.start())
64 } 64 }
65 ReferenceKind::FieldShorthandForLocal => { 65 ReferenceKind::FieldShorthandForLocal => {
66 tested_by!(test_rename_local_for_field_shorthand); 66 mark::hit!(test_rename_local_for_field_shorthand);
67 replacement_text.push_str(": "); 67 replacement_text.push_str(": ");
68 replacement_text.push_str(new_name); 68 replacement_text.push_str(new_name);
69 TextRange::new(reference.file_range.range.end(), reference.file_range.range.end()) 69 TextRange::new(reference.file_range.range.end(), reference.file_range.range.end())
@@ -260,7 +260,7 @@ fn rename_reference(
260mod tests { 260mod tests {
261 use insta::assert_debug_snapshot; 261 use insta::assert_debug_snapshot;
262 use ra_text_edit::TextEditBuilder; 262 use ra_text_edit::TextEditBuilder;
263 use test_utils::{assert_eq_text, covers}; 263 use test_utils::{assert_eq_text, mark};
264 264
265 use crate::{ 265 use crate::{
266 mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId, 266 mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId,
@@ -492,7 +492,7 @@ mod tests {
492 492
493 #[test] 493 #[test]
494 fn test_rename_struct_field_for_shorthand() { 494 fn test_rename_struct_field_for_shorthand() {
495 covers!(test_rename_struct_field_for_shorthand); 495 mark::check!(test_rename_struct_field_for_shorthand);
496 test_rename( 496 test_rename(
497 r#" 497 r#"
498 struct Foo { 498 struct Foo {
@@ -522,7 +522,7 @@ mod tests {
522 522
523 #[test] 523 #[test]
524 fn test_rename_local_for_field_shorthand() { 524 fn test_rename_local_for_field_shorthand() {
525 covers!(test_rename_local_for_field_shorthand); 525 mark::check!(test_rename_local_for_field_shorthand);
526 test_rename( 526 test_rename(
527 r#" 527 r#"
528 struct Foo { 528 struct Foo {
@@ -669,7 +669,7 @@ mod tests {
669 dst_path: "bar/foo2.rs", 669 dst_path: "bar/foo2.rs",
670 }, 670 },
671 ], 671 ],
672 cursor_position: None, 672 is_snippet: false,
673 }, 673 },
674 }, 674 },
675 ) 675 )
@@ -721,7 +721,7 @@ mod tests {
721 dst_path: "foo2/mod.rs", 721 dst_path: "foo2/mod.rs",
722 }, 722 },
723 ], 723 ],
724 cursor_position: None, 724 is_snippet: false,
725 }, 725 },
726 }, 726 },
727 ) 727 )
@@ -817,7 +817,7 @@ mod tests {
817 dst_path: "bar/foo2.rs", 817 dst_path: "bar/foo2.rs",
818 }, 818 },
819 ], 819 ],
820 cursor_position: None, 820 is_snippet: false,
821 }, 821 },
822 }, 822 },
823 ) 823 )
@@ -983,8 +983,8 @@ mod tests {
983 if let Some(change) = source_change { 983 if let Some(change) = source_change {
984 for edit in change.info.source_file_edits { 984 for edit in change.info.source_file_edits {
985 file_id = Some(edit.file_id); 985 file_id = Some(edit.file_id);
986 for indel in edit.edit.as_indels() { 986 for indel in edit.edit.into_iter() {
987 text_edit_builder.replace(indel.delete, indel.insert.clone()); 987 text_edit_builder.replace(indel.delete, indel.insert);
988 } 988 }
989 } 989 }
990 } 990 }