aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/mock_analysis.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-24 10:29:43 +0100
committerAleksey Kladov <[email protected]>2020-06-24 10:29:43 +0100
commitc6795fb83a850dde6ac0b08decf108c0c3aa452a (patch)
tree6f5ae66dc754b6e20069bdcbccf70fa42b236b57 /crates/ra_ide/src/mock_analysis.rs
parente9cb818c2683e06153f013c3b8d03f7f2719eb02 (diff)
More consistent usage of fixtures
Diffstat (limited to 'crates/ra_ide/src/mock_analysis.rs')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index 4e3986604..f568d6baa 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -136,12 +136,6 @@ impl MockAnalysis {
136 self.files.push(MockFileData::new(path.to_string(), text.to_string())); 136 self.files.push(MockFileData::new(path.to_string(), text.to_string()));
137 file_id 137 file_id
138 } 138 }
139 fn add_file_with_position(&mut self, path: &str, text: &str) -> FilePosition {
140 let (offset, text) = extract_offset(text);
141 let file_id = self.next_id();
142 self.files.push(MockFileData::new(path.to_string(), text));
143 FilePosition { file_id, offset }
144 }
145 fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange { 139 fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
146 let (range, text) = extract_range(text); 140 let (range, text) = extract_range(text);
147 let file_id = self.next_id(); 141 let file_id = self.next_id();
@@ -229,9 +223,7 @@ pub fn single_file(ra_fixture: &str) -> (Analysis, FileId) {
229 223
230/// Creates analysis for a single file, returns position marked with <|>. 224/// Creates analysis for a single file, returns position marked with <|>.
231pub fn single_file_with_position(ra_fixture: &str) -> (Analysis, FilePosition) { 225pub fn single_file_with_position(ra_fixture: &str) -> (Analysis, FilePosition) {
232 let mut mock = MockAnalysis::new(); 226 analysis_and_position(ra_fixture)
233 let pos = mock.add_file_with_position("/main.rs", ra_fixture);
234 (mock.analysis(), pos)
235} 227}
236 228
237/// Creates analysis for a single file, returns range marked with a pair of <|>. 229/// Creates analysis for a single file, returns range marked with a pair of <|>.