aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/references.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index ae68b4392..571dd5452 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -686,6 +686,52 @@ fn g() { f(); }
686 ); 686 );
687 } 687 }
688 688
689 #[test]
690 fn test_find_all_refs_struct_pat() {
691 check(
692 r#"
693struct S {
694 field<|>: u8,
695}
696
697fn f(s: S) {
698 match s {
699 S { field } => {}
700 }
701}
702"#,
703 expect![[r#"
704 field RECORD_FIELD FileId(0) 15..24 15..20 Other
705
706 FileId(0) 68..73 FieldShorthandForField Read
707 "#]],
708 );
709 }
710
711 #[test]
712 fn test_find_all_refs_enum_var_pat() {
713 check(
714 r#"
715enum En {
716 Variant {
717 field<|>: u8,
718 }
719}
720
721fn f(e: En) {
722 match e {
723 En::Variant { field } => {}
724 }
725}
726"#,
727 expect![[r#"
728 field RECORD_FIELD FileId(0) 32..41 32..37 Other
729
730 FileId(0) 102..107 FieldShorthandForField Read
731 "#]],
732 );
733 }
734
689 fn check(ra_fixture: &str, expect: Expect) { 735 fn check(ra_fixture: &str, expect: Expect) {
690 check_with_scope(ra_fixture, None, expect) 736 check_with_scope(ra_fixture, None, expect)
691 } 737 }