@@ -18,7 +18,7 @@ const HOVER_BASE_CONFIG: HoverConfig = HoverConfig {
1818 format : HoverDocFormat :: Markdown ,
1919 keywords : true ,
2020 max_trait_assoc_items_count : None ,
21- max_struct_or_union_fields_count : Some ( 5 ) ,
21+ max_fields_count : Some ( 5 ) ,
2222 max_enum_variants_count : Some ( 5 ) ,
2323} ;
2424
@@ -52,7 +52,7 @@ fn check(ra_fixture: &str, expect: Expect) {
5252}
5353
5454#[ track_caller]
55- fn check_hover_struct_or_union_fields_limit (
55+ fn check_hover_fields_limit (
5656 fields_count : impl Into < Option < usize > > ,
5757 ra_fixture : & str ,
5858 expect : Expect ,
@@ -62,7 +62,7 @@ fn check_hover_struct_or_union_fields_limit(
6262 . hover (
6363 & HoverConfig {
6464 links_in_hover : true ,
65- max_struct_or_union_fields_count : fields_count. into ( ) ,
65+ max_fields_count : fields_count. into ( ) ,
6666 ..HOVER_BASE_CONFIG
6767 } ,
6868 FileRange { file_id : position. file_id , range : TextRange :: empty ( position. offset ) } ,
@@ -939,7 +939,7 @@ struct Foo$0 where u32: Copy { field: u32 }
939939
940940#[ test]
941941fn hover_record_struct_limit ( ) {
942- check_hover_struct_or_union_fields_limit (
942+ check_hover_fields_limit (
943943 3 ,
944944 r#"
945945 struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -961,7 +961,7 @@ fn hover_record_struct_limit() {
961961 ```
962962 "# ] ] ,
963963 ) ;
964- check_hover_struct_or_union_fields_limit (
964+ check_hover_fields_limit (
965965 3 ,
966966 r#"
967967 struct Foo$0 { a: u32 }
@@ -981,7 +981,7 @@ fn hover_record_struct_limit() {
981981 ```
982982 "# ] ] ,
983983 ) ;
984- check_hover_struct_or_union_fields_limit (
984+ check_hover_fields_limit (
985985 3 ,
986986 r#"
987987 struct Foo$0 { a: u32, b: i32, c: i32, d: u32 }
@@ -1004,7 +1004,7 @@ fn hover_record_struct_limit() {
10041004 ```
10051005 "# ] ] ,
10061006 ) ;
1007- check_hover_struct_or_union_fields_limit (
1007+ check_hover_fields_limit (
10081008 None ,
10091009 r#"
10101010 struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -1022,7 +1022,7 @@ fn hover_record_struct_limit() {
10221022 ```
10231023 "# ] ] ,
10241024 ) ;
1025- check_hover_struct_or_union_fields_limit (
1025+ check_hover_fields_limit (
10261026 0 ,
10271027 r#"
10281028 struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -1042,6 +1042,100 @@ fn hover_record_struct_limit() {
10421042 )
10431043}
10441044
1045+ #[ test]
1046+ fn hover_record_variant_limit ( ) {
1047+ check_hover_fields_limit (
1048+ 3 ,
1049+ r#"
1050+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1051+ "# ,
1052+ expect ! [ [ r#"
1053+ *A*
1054+
1055+ ```rust
1056+ test::Foo
1057+ ```
1058+
1059+ ```rust
1060+ // size = 12 (0xC), align = 4
1061+ A { a: u32, b: i32, c: i32, }
1062+ ```
1063+ "# ] ] ,
1064+ ) ;
1065+ check_hover_fields_limit (
1066+ 3 ,
1067+ r#"
1068+ enum Foo { A$0 { a: u32 } }
1069+ "# ,
1070+ expect ! [ [ r#"
1071+ *A*
1072+
1073+ ```rust
1074+ test::Foo
1075+ ```
1076+
1077+ ```rust
1078+ // size = 4, align = 4
1079+ A { a: u32, }
1080+ ```
1081+ "# ] ] ,
1082+ ) ;
1083+ check_hover_fields_limit (
1084+ 3 ,
1085+ r#"
1086+ enum Foo { A$0 { a: u32, b: i32, c: i32, d: u32 } }
1087+ "# ,
1088+ expect ! [ [ r#"
1089+ *A*
1090+
1091+ ```rust
1092+ test::Foo
1093+ ```
1094+
1095+ ```rust
1096+ // size = 16 (0x10), align = 4
1097+ A { a: u32, b: i32, c: i32, /* … */ }
1098+ ```
1099+ "# ] ] ,
1100+ ) ;
1101+ check_hover_fields_limit (
1102+ None ,
1103+ r#"
1104+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1105+ "# ,
1106+ expect ! [ [ r#"
1107+ *A*
1108+
1109+ ```rust
1110+ test::Foo
1111+ ```
1112+
1113+ ```rust
1114+ // size = 12 (0xC), align = 4
1115+ A
1116+ ```
1117+ "# ] ] ,
1118+ ) ;
1119+ check_hover_fields_limit (
1120+ 0 ,
1121+ r#"
1122+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1123+ "# ,
1124+ expect ! [ [ r#"
1125+ *A*
1126+
1127+ ```rust
1128+ test::Foo
1129+ ```
1130+
1131+ ```rust
1132+ // size = 12 (0xC), align = 4
1133+ A { /* … */ }
1134+ ```
1135+ "# ] ] ,
1136+ ) ;
1137+ }
1138+
10451139#[ test]
10461140fn hover_enum_limit ( ) {
10471141 check_hover_enum_variants_limit (
@@ -1152,7 +1246,7 @@ fn hover_enum_limit() {
11521246
11531247#[ test]
11541248fn hover_union_limit ( ) {
1155- check_hover_struct_or_union_fields_limit (
1249+ check_hover_fields_limit (
11561250 5 ,
11571251 r#"union Foo$0 { a: u32, b: i32 }"# ,
11581252 expect ! [ [ r#"
@@ -1171,7 +1265,7 @@ fn hover_union_limit() {
11711265 ```
11721266 "# ] ] ,
11731267 ) ;
1174- check_hover_struct_or_union_fields_limit (
1268+ check_hover_fields_limit (
11751269 1 ,
11761270 r#"union Foo$0 { a: u32, b: i32 }"# ,
11771271 expect ! [ [ r#"
@@ -1190,7 +1284,7 @@ fn hover_union_limit() {
11901284 ```
11911285 "# ] ] ,
11921286 ) ;
1193- check_hover_struct_or_union_fields_limit (
1287+ check_hover_fields_limit (
11941288 0 ,
11951289 r#"union Foo$0 { a: u32, b: i32 }"# ,
11961290 expect ! [ [ r#"
@@ -1206,7 +1300,7 @@ fn hover_union_limit() {
12061300 ```
12071301 "# ] ] ,
12081302 ) ;
1209- check_hover_struct_or_union_fields_limit (
1303+ check_hover_fields_limit (
12101304 None ,
12111305 r#"union Foo$0 { a: u32, b: i32 }"# ,
12121306 expect ! [ [ r#"
@@ -1691,7 +1785,7 @@ impl Thing {
16911785 ```
16921786 "# ] ] ,
16931787 ) ;
1694- check_hover_struct_or_union_fields_limit (
1788+ check_hover_fields_limit (
16951789 None ,
16961790 r#"
16971791struct Thing { x: u32 }
@@ -6832,7 +6926,7 @@ enum Enum {
68326926
68336927 ```rust
68346928 // size = 4, align = 4
6835- RecordV { field: u32 }
6929+ RecordV { field: u32, }
68366930 ```
68376931 "# ] ] ,
68386932 ) ;
0 commit comments