mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Simplify
This commit is contained in:
parent
d4a493078a
commit
9d64525daa
2 changed files with 3 additions and 14 deletions
|
@ -126,12 +126,6 @@ impl MockAnalysis {
|
||||||
file_id
|
file_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_file(&mut self, path: &str, text: &str) -> FileId {
|
|
||||||
let file_id = self.next_id();
|
|
||||||
self.files.push(MockFileData::new(path.to_string(), text.to_string()));
|
|
||||||
file_id
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
|
fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
|
||||||
let (range, text) = extract_range(text);
|
let (range, text) = extract_range(text);
|
||||||
let file_id = self.next_id();
|
let file_id = self.next_id();
|
||||||
|
|
|
@ -2,10 +2,7 @@ use std::fs;
|
||||||
|
|
||||||
use test_utils::{assert_eq_text, project_dir, read_text};
|
use test_utils::{assert_eq_text, project_dir, read_text};
|
||||||
|
|
||||||
use crate::{
|
use crate::{mock_analysis::single_file, FileRange, TextRange};
|
||||||
mock_analysis::{single_file, MockAnalysis},
|
|
||||||
FileRange, TextRange,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_highlighting() {
|
fn test_highlighting() {
|
||||||
|
@ -127,12 +124,10 @@ fn accidentally_quadratic() {
|
||||||
let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic");
|
let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic");
|
||||||
let src = fs::read_to_string(file).unwrap();
|
let src = fs::read_to_string(file).unwrap();
|
||||||
|
|
||||||
let mut mock = MockAnalysis::new();
|
let (analysis, file_id) = single_file(&src);
|
||||||
let file_id = mock.add_file("/main.rs", &src);
|
|
||||||
let host = mock.analysis_host();
|
|
||||||
|
|
||||||
// let t = std::time::Instant::now();
|
// let t = std::time::Instant::now();
|
||||||
let _ = host.analysis().highlight(file_id).unwrap();
|
let _ = analysis.highlight(file_id).unwrap();
|
||||||
// eprintln!("elapsed: {:?}", t.elapsed());
|
// eprintln!("elapsed: {:?}", t.elapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue