@@ -41,7 +41,7 @@ pub struct AnnotationConfig {
4141 pub annotate_references : bool ,
4242 pub annotate_method_references : bool ,
4343 pub annotate_enum_variant_references : bool ,
44- pub annotation_location : AnnotationLocation ,
44+ pub location : AnnotationLocation ,
4545}
4646
4747pub enum AnnotationLocation {
@@ -137,7 +137,7 @@ pub(crate) fn annotations(
137137 ) -> Option < TextRange > {
138138 if let Some ( InFile { file_id, value } ) = node. original_ast_node ( db) {
139139 if file_id == source_file_id. into ( ) {
140- return match config. annotation_location {
140+ return match config. location {
141141 AnnotationLocation :: AboveName => {
142142 value. name ( ) . map ( |name| name. syntax ( ) . text_range ( ) )
143143 }
@@ -212,10 +212,10 @@ mod tests {
212212 annotate_references : true ,
213213 annotate_method_references : true ,
214214 annotate_enum_variant_references : true ,
215- annotation_location : AnnotationLocation :: AboveName ,
215+ location : AnnotationLocation :: AboveName ,
216216 } ;
217217
218- fn check ( ra_fixture : & str , expect : Expect , config : & AnnotationConfig ) {
218+ fn check_with_config ( ra_fixture : & str , expect : Expect , config : & AnnotationConfig ) {
219219 let ( analysis, file_id) = fixture:: file ( ra_fixture) ;
220220
221221 let annotations: Vec < Annotation > = analysis
@@ -228,6 +228,10 @@ mod tests {
228228 expect. assert_debug_eq ( & annotations) ;
229229 }
230230
231+ fn check ( ra_fixture : & str , expect : Expect ) {
232+ check_with_config ( ra_fixture, expect, & DEFAULT_CONFIG ) ;
233+ }
234+
231235 #[ test]
232236 fn const_annotations ( ) {
233237 check (
@@ -303,7 +307,6 @@ fn main() {
303307 },
304308 ]
305309 "# ] ] ,
306- & DEFAULT_CONFIG ,
307310 ) ;
308311 }
309312
@@ -380,7 +383,6 @@ fn main() {
380383 },
381384 ]
382385 "# ] ] ,
383- & DEFAULT_CONFIG ,
384386 ) ;
385387 }
386388
@@ -516,7 +518,6 @@ fn main() {
516518 },
517519 ]
518520 "# ] ] ,
519- & DEFAULT_CONFIG ,
520521 ) ;
521522 }
522523
@@ -560,7 +561,6 @@ fn main() {}
560561 },
561562 ]
562563 "# ] ] ,
563- & DEFAULT_CONFIG ,
564564 ) ;
565565 }
566566
@@ -675,7 +675,6 @@ fn main() {
675675 },
676676 ]
677677 "# ] ] ,
678- & DEFAULT_CONFIG ,
679678 ) ;
680679 }
681680
@@ -772,7 +771,6 @@ mod tests {
772771 },
773772 ]
774773 "# ] ] ,
775- & DEFAULT_CONFIG ,
776774 ) ;
777775 }
778776
@@ -788,7 +786,6 @@ struct Foo;
788786 expect ! [ [ r#"
789787 []
790788 "# ] ] ,
791- & DEFAULT_CONFIG ,
792789 ) ;
793790 }
794791
@@ -808,13 +805,12 @@ m!();
808805 expect ! [ [ r#"
809806 []
810807 "# ] ] ,
811- & DEFAULT_CONFIG ,
812808 ) ;
813809 }
814810
815811 #[ test]
816812 fn test_annotations_appear_above_whole_item_when_configured_to_do_so ( ) {
817- check (
813+ check_with_config (
818814 r#"
819815/// This is a struct named Foo, obviously.
820816#[derive(Clone)]
@@ -844,10 +840,7 @@ struct Foo;
844840 },
845841 ]
846842 "# ] ] ,
847- & AnnotationConfig {
848- annotation_location : AnnotationLocation :: AboveWholeItem ,
849- ..DEFAULT_CONFIG
850- } ,
843+ & AnnotationConfig { location : AnnotationLocation :: AboveWholeItem , ..DEFAULT_CONFIG } ,
851844 ) ;
852845 }
853846}
0 commit comments