diff options
Diffstat (limited to 'crates/ra_ide_api/src/mock_analysis.rs')
-rw-r--r-- | crates/ra_ide_api/src/mock_analysis.rs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs index 0eaf5d15a..132f6f875 100644 --- a/crates/ra_ide_api/src/mock_analysis.rs +++ b/crates/ra_ide_api/src/mock_analysis.rs | |||
@@ -80,15 +80,6 @@ impl MockAnalysis { | |||
80 | .expect("no file in this mock"); | 80 | .expect("no file in this mock"); |
81 | FileId(idx as u32 + 1) | 81 | FileId(idx as u32 + 1) |
82 | } | 82 | } |
83 | pub fn id_and_contents_of(&self, path: &str) -> (FileId, String) { | ||
84 | let (idx, contents) = self | ||
85 | .files | ||
86 | .iter() | ||
87 | .enumerate() | ||
88 | .find(|(_, (p, _text))| path == p) | ||
89 | .expect("no file in this mock"); | ||
90 | (FileId(idx as u32 + 1), contents.1.to_string()) | ||
91 | } | ||
92 | pub fn analysis_host(self) -> AnalysisHost { | 83 | pub fn analysis_host(self) -> AnalysisHost { |
93 | let mut host = AnalysisHost::default(); | 84 | let mut host = AnalysisHost::default(); |
94 | let source_root = SourceRootId(0); | 85 | let source_root = SourceRootId(0); |
@@ -133,14 +124,6 @@ pub fn single_file(code: &str) -> (Analysis, FileId) { | |||
133 | (mock.analysis(), file_id) | 124 | (mock.analysis(), file_id) |
134 | } | 125 | } |
135 | 126 | ||
136 | /// Creates analysis from a fixture with multiple files | ||
137 | /// and returns the file id and contents of the target file. | ||
138 | pub fn fixture_with_target_file(fixture: &str, target_file: &str) -> (Analysis, FileId, String) { | ||
139 | let mock = MockAnalysis::with_files(fixture); | ||
140 | let (target_file_id, target_file_contents) = mock.id_and_contents_of(target_file); | ||
141 | (mock.analysis(), target_file_id, target_file_contents) | ||
142 | } | ||
143 | |||
144 | /// Creates analysis for a single file, returns position marked with <|>. | 127 | /// Creates analysis for a single file, returns position marked with <|>. |
145 | pub fn single_file_with_position(code: &str) -> (Analysis, FilePosition) { | 128 | pub fn single_file_with_position(code: &str) -> (Analysis, FilePosition) { |
146 | let mut mock = MockAnalysis::new(); | 129 | let mut mock = MockAnalysis::new(); |