@@ -14,7 +14,7 @@ use crate::{
1414/// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis
1515/// from a set of in-memory files.
1616#[ derive( Debug , Default ) ]
17- pub struct MockAnalysis {
17+ pub ( crate ) struct MockAnalysis {
1818 files : Vec < Fixture > ,
1919}
2020
@@ -29,15 +29,15 @@ impl MockAnalysis {
2929 /// //- /foo.rs
3030 /// struct Baz;
3131 /// ```
32- pub fn with_files ( ra_fixture : & str ) -> MockAnalysis {
32+ pub ( crate ) fn with_files ( ra_fixture : & str ) -> MockAnalysis {
3333 let ( res, pos) = MockAnalysis :: with_fixture ( ra_fixture) ;
3434 assert ! ( pos. is_none( ) ) ;
3535 res
3636 }
3737
3838 /// Same as `with_files`, but requires that a single file contains a `<|>` marker,
3939 /// whose position is also returned.
40- pub fn with_files_and_position ( fixture : & str ) -> ( MockAnalysis , FilePosition ) {
40+ pub ( crate ) fn with_files_and_position ( fixture : & str ) -> ( MockAnalysis , FilePosition ) {
4141 let ( res, position) = MockAnalysis :: with_fixture ( fixture) ;
4242 let ( file_id, range_or_offset) = position. expect ( "expected a marker (<|>)" ) ;
4343 let offset = match range_or_offset {
@@ -70,12 +70,12 @@ impl MockAnalysis {
7070 file_id
7171 }
7272
73- pub fn id_of ( & self , path : & str ) -> FileId {
73+ pub ( crate ) fn id_of ( & self , path : & str ) -> FileId {
7474 let ( file_id, _) =
7575 self . files ( ) . find ( |( _, data) | path == data. path ) . expect ( "no file in this mock" ) ;
7676 file_id
7777 }
78- pub fn annotations ( & self ) -> Vec < ( FileRange , String ) > {
78+ pub ( crate ) fn annotations ( & self ) -> Vec < ( FileRange , String ) > {
7979 self . files ( )
8080 . flat_map ( |( file_id, fixture) | {
8181 let annotations = extract_annotations ( & fixture. text ) ;
@@ -85,15 +85,15 @@ impl MockAnalysis {
8585 } )
8686 . collect ( )
8787 }
88- pub fn files ( & self ) -> impl Iterator < Item = ( FileId , & Fixture ) > + ' _ {
88+ pub ( crate ) fn files ( & self ) -> impl Iterator < Item = ( FileId , & Fixture ) > + ' _ {
8989 self . files . iter ( ) . enumerate ( ) . map ( |( idx, fixture) | ( FileId ( idx as u32 + 1 ) , fixture) )
9090 }
91- pub fn annotation ( & self ) -> ( FileRange , String ) {
91+ pub ( crate ) fn annotation ( & self ) -> ( FileRange , String ) {
9292 let mut all = self . annotations ( ) ;
9393 assert_eq ! ( all. len( ) , 1 ) ;
9494 all. pop ( ) . unwrap ( )
9595 }
96- pub fn analysis_host ( self ) -> AnalysisHost {
96+ pub ( crate ) fn analysis_host ( self ) -> AnalysisHost {
9797 let mut host = AnalysisHost :: default ( ) ;
9898 let mut change = AnalysisChange :: new ( ) ;
9999 let mut file_set = FileSet :: default ( ) ;
@@ -146,26 +146,26 @@ impl MockAnalysis {
146146 host. apply_change ( change) ;
147147 host
148148 }
149- pub fn analysis ( self ) -> Analysis {
149+ pub ( crate ) fn analysis ( self ) -> Analysis {
150150 self . analysis_host ( ) . analysis ( )
151151 }
152152}
153153
154154/// Creates analysis from a multi-file fixture, returns positions marked with <|>.
155- pub fn analysis_and_position ( ra_fixture : & str ) -> ( Analysis , FilePosition ) {
155+ pub ( crate ) fn analysis_and_position ( ra_fixture : & str ) -> ( Analysis , FilePosition ) {
156156 let ( mock, position) = MockAnalysis :: with_files_and_position ( ra_fixture) ;
157157 ( mock. analysis ( ) , position)
158158}
159159
160160/// Creates analysis for a single file.
161- pub fn single_file ( ra_fixture : & str ) -> ( Analysis , FileId ) {
161+ pub ( crate ) fn single_file ( ra_fixture : & str ) -> ( Analysis , FileId ) {
162162 let mock = MockAnalysis :: with_files ( ra_fixture) ;
163163 let file_id = mock. id_of ( "/main.rs" ) ;
164164 ( mock. analysis ( ) , file_id)
165165}
166166
167167/// Creates analysis for a single file, returns range marked with a pair of <|>.
168- pub fn analysis_and_range ( ra_fixture : & str ) -> ( Analysis , FileRange ) {
168+ pub ( crate ) fn analysis_and_range ( ra_fixture : & str ) -> ( Analysis , FileRange ) {
169169 let ( res, position) = MockAnalysis :: with_fixture ( ra_fixture) ;
170170 let ( file_id, range_or_offset) = position. expect ( "expected a marker (<|>)" ) ;
171171 let range = match range_or_offset {
0 commit comments