11//! Utilities for creating `Analysis` instances for tests.
2- use hir:: db:: DefDatabase ;
32use ide_db:: base_db:: fixture:: ChangeFixture ;
43use test_utils:: { extract_annotations, RangeOrOffset } ;
54
@@ -9,7 +8,7 @@ use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange};
98pub ( crate ) fn file ( ra_fixture : & str ) -> ( Analysis , FileId ) {
109 let mut host = AnalysisHost :: default ( ) ;
1110 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
12- host. db . set_enable_proc_attr_macros ( true ) ;
11+ host. db . enable_proc_attr_macros ( ) ;
1312 host. db . apply_change ( change_fixture. change ) ;
1413 ( host. analysis ( ) , change_fixture. files [ 0 ] )
1514}
@@ -18,7 +17,7 @@ pub(crate) fn file(ra_fixture: &str) -> (Analysis, FileId) {
1817pub ( crate ) fn position ( ra_fixture : & str ) -> ( Analysis , FilePosition ) {
1918 let mut host = AnalysisHost :: default ( ) ;
2019 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
21- host. db . set_enable_proc_attr_macros ( true ) ;
20+ host. db . enable_proc_attr_macros ( ) ;
2221 host. db . apply_change ( change_fixture. change ) ;
2322 let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
2423 let offset = range_or_offset. expect_offset ( ) ;
@@ -29,7 +28,7 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) {
2928pub ( crate ) fn range ( ra_fixture : & str ) -> ( Analysis , FileRange ) {
3029 let mut host = AnalysisHost :: default ( ) ;
3130 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
32- host. db . set_enable_proc_attr_macros ( true ) ;
31+ host. db . enable_proc_attr_macros ( ) ;
3332 host. db . apply_change ( change_fixture. change ) ;
3433 let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
3534 let range = range_or_offset. expect_range ( ) ;
@@ -40,7 +39,7 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) {
4039pub ( crate ) fn range_or_position ( ra_fixture : & str ) -> ( Analysis , FileId , RangeOrOffset ) {
4140 let mut host = AnalysisHost :: default ( ) ;
4241 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
43- host. db . set_enable_proc_attr_macros ( true ) ;
42+ host. db . enable_proc_attr_macros ( ) ;
4443 host. db . apply_change ( change_fixture. change ) ;
4544 let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
4645 ( host. analysis ( ) , file_id, range_or_offset)
@@ -50,7 +49,7 @@ pub(crate) fn range_or_position(ra_fixture: &str) -> (Analysis, FileId, RangeOrO
5049pub ( crate ) fn annotations ( ra_fixture : & str ) -> ( Analysis , FilePosition , Vec < ( FileRange , String ) > ) {
5150 let mut host = AnalysisHost :: default ( ) ;
5251 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
53- host. db . set_enable_proc_attr_macros ( true ) ;
52+ host. db . enable_proc_attr_macros ( ) ;
5453 host. db . apply_change ( change_fixture. change ) ;
5554 let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
5655 let offset = range_or_offset. expect_offset ( ) ;
@@ -71,7 +70,7 @@ pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(Fil
7170pub ( crate ) fn annotations_without_marker ( ra_fixture : & str ) -> ( Analysis , Vec < ( FileRange , String ) > ) {
7271 let mut host = AnalysisHost :: default ( ) ;
7372 let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
74- host. db . set_enable_proc_attr_macros ( true ) ;
73+ host. db . enable_proc_attr_macros ( ) ;
7574 host. db . apply_change ( change_fixture. change ) ;
7675
7776 let annotations = change_fixture
0 commit comments