aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-24 10:50:53 +0100
committerAleksey Kladov <[email protected]>2020-06-24 10:50:53 +0100
commit9d64525daa16eb25c15a97d7dd8e099f6ff102c7 (patch)
tree7d70d67d6d0f1cd3a9a09d847ed7f5a9bd7d4e14 /crates/ra_ide
parentd4a493078ad0e79a8b401af40274089d8235827f (diff)
Simplify
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs6
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs11
2 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index 5bad3911f..79b796544 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -126,12 +126,6 @@ impl MockAnalysis {
126 file_id 126 file_id
127 } 127 }
128 128
129 pub fn add_file(&mut self, path: &str, text: &str) -> FileId {
130 let file_id = self.next_id();
131 self.files.push(MockFileData::new(path.to_string(), text.to_string()));
132 file_id
133 }
134
135 fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange { 129 fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
136 let (range, text) = extract_range(text); 130 let (range, text) = extract_range(text);
137 let file_id = self.next_id(); 131 let file_id = self.next_id();
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index c8943816f..b7fad9719 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -2,10 +2,7 @@ use std::fs;
2 2
3use test_utils::{assert_eq_text, project_dir, read_text}; 3use test_utils::{assert_eq_text, project_dir, read_text};
4 4
5use crate::{ 5use crate::{mock_analysis::single_file, FileRange, TextRange};
6 mock_analysis::{single_file, MockAnalysis},
7 FileRange, TextRange,
8};
9 6
10#[test] 7#[test]
11fn test_highlighting() { 8fn test_highlighting() {
@@ -127,12 +124,10 @@ fn accidentally_quadratic() {
127 let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic"); 124 let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic");
128 let src = fs::read_to_string(file).unwrap(); 125 let src = fs::read_to_string(file).unwrap();
129 126
130 let mut mock = MockAnalysis::new(); 127 let (analysis, file_id) = single_file(&src);
131 let file_id = mock.add_file("/main.rs", &src);
132 let host = mock.analysis_host();
133 128
134 // let t = std::time::Instant::now(); 129 // let t = std::time::Instant::now();
135 let _ = host.analysis().highlight(file_id).unwrap(); 130 let _ = analysis.highlight(file_id).unwrap();
136 // eprintln!("elapsed: {:?}", t.elapsed()); 131 // eprintln!("elapsed: {:?}", t.elapsed());
137} 132}
138 133