diff options
Diffstat (limited to 'crates/ide/src/references')
-rw-r--r-- | crates/ide/src/references/rename.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 301629763..8cbe1ae5a 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -275,11 +275,11 @@ mod tests { | |||
275 | use test_utils::{assert_eq_text, mark}; | 275 | use test_utils::{assert_eq_text, mark}; |
276 | use text_edit::TextEdit; | 276 | use text_edit::TextEdit; |
277 | 277 | ||
278 | use crate::{mock_analysis::analysis_and_position, FileId}; | 278 | use crate::{fixture, FileId}; |
279 | 279 | ||
280 | fn check(new_name: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | 280 | fn check(new_name: &str, ra_fixture_before: &str, ra_fixture_after: &str) { |
281 | let ra_fixture_after = &trim_indent(ra_fixture_after); | 281 | let ra_fixture_after = &trim_indent(ra_fixture_after); |
282 | let (analysis, position) = analysis_and_position(ra_fixture_before); | 282 | let (analysis, position) = fixture::position(ra_fixture_before); |
283 | let source_change = analysis.rename(position, new_name).unwrap(); | 283 | let source_change = analysis.rename(position, new_name).unwrap(); |
284 | let mut text_edit_builder = TextEdit::builder(); | 284 | let mut text_edit_builder = TextEdit::builder(); |
285 | let mut file_id: Option<FileId> = None; | 285 | let mut file_id: Option<FileId> = None; |
@@ -297,7 +297,7 @@ mod tests { | |||
297 | } | 297 | } |
298 | 298 | ||
299 | fn check_expect(new_name: &str, ra_fixture: &str, expect: Expect) { | 299 | fn check_expect(new_name: &str, ra_fixture: &str, expect: Expect) { |
300 | let (analysis, position) = analysis_and_position(ra_fixture); | 300 | let (analysis, position) = fixture::position(ra_fixture); |
301 | let source_change = analysis.rename(position, new_name).unwrap().unwrap(); | 301 | let source_change = analysis.rename(position, new_name).unwrap().unwrap(); |
302 | expect.assert_debug_eq(&source_change) | 302 | expect.assert_debug_eq(&source_change) |
303 | } | 303 | } |
@@ -314,7 +314,7 @@ mod tests { | |||
314 | 314 | ||
315 | #[test] | 315 | #[test] |
316 | fn test_rename_to_invalid_identifier() { | 316 | fn test_rename_to_invalid_identifier() { |
317 | let (analysis, position) = analysis_and_position(r#"fn main() { let i<|> = 1; }"#); | 317 | let (analysis, position) = fixture::position(r#"fn main() { let i<|> = 1; }"#); |
318 | let new_name = "invalid!"; | 318 | let new_name = "invalid!"; |
319 | let source_change = analysis.rename(position, new_name).unwrap(); | 319 | let source_change = analysis.rename(position, new_name).unwrap(); |
320 | assert!(source_change.is_none()); | 320 | assert!(source_change.is_none()); |
@@ -602,7 +602,7 @@ mod foo<|>; | |||
602 | source_file_edits: [ | 602 | source_file_edits: [ |
603 | SourceFileEdit { | 603 | SourceFileEdit { |
604 | file_id: FileId( | 604 | file_id: FileId( |
605 | 2, | 605 | 1, |
606 | ), | 606 | ), |
607 | edit: TextEdit { | 607 | edit: TextEdit { |
608 | indels: [ | 608 | indels: [ |
@@ -617,10 +617,10 @@ mod foo<|>; | |||
617 | file_system_edits: [ | 617 | file_system_edits: [ |
618 | MoveFile { | 618 | MoveFile { |
619 | src: FileId( | 619 | src: FileId( |
620 | 3, | 620 | 2, |
621 | ), | 621 | ), |
622 | anchor: FileId( | 622 | anchor: FileId( |
623 | 3, | 623 | 2, |
624 | ), | 624 | ), |
625 | dst: "foo2.rs", | 625 | dst: "foo2.rs", |
626 | }, | 626 | }, |
@@ -655,7 +655,7 @@ use crate::foo<|>::FooContent; | |||
655 | source_file_edits: [ | 655 | source_file_edits: [ |
656 | SourceFileEdit { | 656 | SourceFileEdit { |
657 | file_id: FileId( | 657 | file_id: FileId( |
658 | 1, | 658 | 0, |
659 | ), | 659 | ), |
660 | edit: TextEdit { | 660 | edit: TextEdit { |
661 | indels: [ | 661 | indels: [ |
@@ -668,7 +668,7 @@ use crate::foo<|>::FooContent; | |||
668 | }, | 668 | }, |
669 | SourceFileEdit { | 669 | SourceFileEdit { |
670 | file_id: FileId( | 670 | file_id: FileId( |
671 | 3, | 671 | 2, |
672 | ), | 672 | ), |
673 | edit: TextEdit { | 673 | edit: TextEdit { |
674 | indels: [ | 674 | indels: [ |
@@ -683,10 +683,10 @@ use crate::foo<|>::FooContent; | |||
683 | file_system_edits: [ | 683 | file_system_edits: [ |
684 | MoveFile { | 684 | MoveFile { |
685 | src: FileId( | 685 | src: FileId( |
686 | 2, | 686 | 1, |
687 | ), | 687 | ), |
688 | anchor: FileId( | 688 | anchor: FileId( |
689 | 2, | 689 | 1, |
690 | ), | 690 | ), |
691 | dst: "quux.rs", | 691 | dst: "quux.rs", |
692 | }, | 692 | }, |
@@ -715,7 +715,7 @@ mod fo<|>o; | |||
715 | source_file_edits: [ | 715 | source_file_edits: [ |
716 | SourceFileEdit { | 716 | SourceFileEdit { |
717 | file_id: FileId( | 717 | file_id: FileId( |
718 | 1, | 718 | 0, |
719 | ), | 719 | ), |
720 | edit: TextEdit { | 720 | edit: TextEdit { |
721 | indels: [ | 721 | indels: [ |
@@ -730,10 +730,10 @@ mod fo<|>o; | |||
730 | file_system_edits: [ | 730 | file_system_edits: [ |
731 | MoveFile { | 731 | MoveFile { |
732 | src: FileId( | 732 | src: FileId( |
733 | 2, | 733 | 1, |
734 | ), | 734 | ), |
735 | anchor: FileId( | 735 | anchor: FileId( |
736 | 2, | 736 | 1, |
737 | ), | 737 | ), |
738 | dst: "../foo2/mod.rs", | 738 | dst: "../foo2/mod.rs", |
739 | }, | 739 | }, |
@@ -763,7 +763,7 @@ mod outer { mod fo<|>o; } | |||
763 | source_file_edits: [ | 763 | source_file_edits: [ |
764 | SourceFileEdit { | 764 | SourceFileEdit { |
765 | file_id: FileId( | 765 | file_id: FileId( |
766 | 1, | 766 | 0, |
767 | ), | 767 | ), |
768 | edit: TextEdit { | 768 | edit: TextEdit { |
769 | indels: [ | 769 | indels: [ |
@@ -778,10 +778,10 @@ mod outer { mod fo<|>o; } | |||
778 | file_system_edits: [ | 778 | file_system_edits: [ |
779 | MoveFile { | 779 | MoveFile { |
780 | src: FileId( | 780 | src: FileId( |
781 | 2, | 781 | 1, |
782 | ), | 782 | ), |
783 | anchor: FileId( | 783 | anchor: FileId( |
784 | 2, | 784 | 1, |
785 | ), | 785 | ), |
786 | dst: "bar.rs", | 786 | dst: "bar.rs", |
787 | }, | 787 | }, |
@@ -834,7 +834,7 @@ pub mod foo<|>; | |||
834 | source_file_edits: [ | 834 | source_file_edits: [ |
835 | SourceFileEdit { | 835 | SourceFileEdit { |
836 | file_id: FileId( | 836 | file_id: FileId( |
837 | 2, | 837 | 1, |
838 | ), | 838 | ), |
839 | edit: TextEdit { | 839 | edit: TextEdit { |
840 | indels: [ | 840 | indels: [ |
@@ -847,7 +847,7 @@ pub mod foo<|>; | |||
847 | }, | 847 | }, |
848 | SourceFileEdit { | 848 | SourceFileEdit { |
849 | file_id: FileId( | 849 | file_id: FileId( |
850 | 1, | 850 | 0, |
851 | ), | 851 | ), |
852 | edit: TextEdit { | 852 | edit: TextEdit { |
853 | indels: [ | 853 | indels: [ |
@@ -862,10 +862,10 @@ pub mod foo<|>; | |||
862 | file_system_edits: [ | 862 | file_system_edits: [ |
863 | MoveFile { | 863 | MoveFile { |
864 | src: FileId( | 864 | src: FileId( |
865 | 3, | 865 | 2, |
866 | ), | 866 | ), |
867 | anchor: FileId( | 867 | anchor: FileId( |
868 | 3, | 868 | 2, |
869 | ), | 869 | ), |
870 | dst: "foo2.rs", | 870 | dst: "foo2.rs", |
871 | }, | 871 | }, |