@@ -41,7 +41,7 @@ pub struct AnnotationConfig {
41
41
pub annotate_references : bool ,
42
42
pub annotate_method_references : bool ,
43
43
pub annotate_enum_variant_references : bool ,
44
- pub annotation_location : AnnotationLocation ,
44
+ pub location : AnnotationLocation ,
45
45
}
46
46
47
47
pub enum AnnotationLocation {
@@ -137,7 +137,7 @@ pub(crate) fn annotations(
137
137
) -> Option < TextRange > {
138
138
if let Some ( InFile { file_id, value } ) = node. original_ast_node ( db) {
139
139
if file_id == source_file_id. into ( ) {
140
- return match config. annotation_location {
140
+ return match config. location {
141
141
AnnotationLocation :: AboveName => {
142
142
value. name ( ) . map ( |name| name. syntax ( ) . text_range ( ) )
143
143
}
@@ -212,10 +212,10 @@ mod tests {
212
212
annotate_references : true ,
213
213
annotate_method_references : true ,
214
214
annotate_enum_variant_references : true ,
215
- annotation_location : AnnotationLocation :: AboveName ,
215
+ location : AnnotationLocation :: AboveName ,
216
216
} ;
217
217
218
- fn check ( ra_fixture : & str , expect : Expect , config : & AnnotationConfig ) {
218
+ fn check_with_config ( ra_fixture : & str , expect : Expect , config : & AnnotationConfig ) {
219
219
let ( analysis, file_id) = fixture:: file ( ra_fixture) ;
220
220
221
221
let annotations: Vec < Annotation > = analysis
@@ -228,6 +228,10 @@ mod tests {
228
228
expect. assert_debug_eq ( & annotations) ;
229
229
}
230
230
231
+ fn check ( ra_fixture : & str , expect : Expect ) {
232
+ check_with_config ( ra_fixture, expect, & DEFAULT_CONFIG ) ;
233
+ }
234
+
231
235
#[ test]
232
236
fn const_annotations ( ) {
233
237
check (
@@ -303,7 +307,6 @@ fn main() {
303
307
},
304
308
]
305
309
"# ] ] ,
306
- & DEFAULT_CONFIG ,
307
310
) ;
308
311
}
309
312
@@ -380,7 +383,6 @@ fn main() {
380
383
},
381
384
]
382
385
"# ] ] ,
383
- & DEFAULT_CONFIG ,
384
386
) ;
385
387
}
386
388
@@ -516,7 +518,6 @@ fn main() {
516
518
},
517
519
]
518
520
"# ] ] ,
519
- & DEFAULT_CONFIG ,
520
521
) ;
521
522
}
522
523
@@ -560,7 +561,6 @@ fn main() {}
560
561
},
561
562
]
562
563
"# ] ] ,
563
- & DEFAULT_CONFIG ,
564
564
) ;
565
565
}
566
566
@@ -675,7 +675,6 @@ fn main() {
675
675
},
676
676
]
677
677
"# ] ] ,
678
- & DEFAULT_CONFIG ,
679
678
) ;
680
679
}
681
680
@@ -772,7 +771,6 @@ mod tests {
772
771
},
773
772
]
774
773
"# ] ] ,
775
- & DEFAULT_CONFIG ,
776
774
) ;
777
775
}
778
776
@@ -788,7 +786,6 @@ struct Foo;
788
786
expect ! [ [ r#"
789
787
[]
790
788
"# ] ] ,
791
- & DEFAULT_CONFIG ,
792
789
) ;
793
790
}
794
791
@@ -808,13 +805,12 @@ m!();
808
805
expect ! [ [ r#"
809
806
[]
810
807
"# ] ] ,
811
- & DEFAULT_CONFIG ,
812
808
) ;
813
809
}
814
810
815
811
#[ test]
816
812
fn test_annotations_appear_above_whole_item_when_configured_to_do_so ( ) {
817
- check (
813
+ check_with_config (
818
814
r#"
819
815
/// This is a struct named Foo, obviously.
820
816
#[derive(Clone)]
@@ -844,10 +840,7 @@ struct Foo;
844
840
},
845
841
]
846
842
"# ] ] ,
847
- & AnnotationConfig {
848
- annotation_location : AnnotationLocation :: AboveWholeItem ,
849
- ..DEFAULT_CONFIG
850
- } ,
843
+ & AnnotationConfig { location : AnnotationLocation :: AboveWholeItem , ..DEFAULT_CONFIG } ,
851
844
) ;
852
845
}
853
846
}
0 commit comments