diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-23 22:47:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-23 22:47:00 +0100 |
commit | 44cf263edf1c7e3b189ef5f1cfdf207dd28a0054 (patch) | |
tree | a9e1bf901384003b5c740ac742c45407e1c1a048 /crates | |
parent | e2e373e0716cea4ea341c7f381da0d39f484cd30 (diff) | |
parent | 7ce122b1df3369cc9bc810cbe4047663491449cd (diff) |
Merge #5008
5008: Remove useless test code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/support.rs | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index e80ffe5d1..001a2a104 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -9,9 +9,7 @@ use std::{ | |||
9 | use crossbeam_channel::{after, select, Receiver}; | 9 | use crossbeam_channel::{after, select, Receiver}; |
10 | use lsp_server::{Connection, Message, Notification, Request}; | 10 | use lsp_server::{Connection, Message, Notification, Request}; |
11 | use lsp_types::{ | 11 | use lsp_types::{ |
12 | notification::{DidOpenTextDocument, Exit}, | 12 | notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, |
13 | request::Shutdown, | ||
14 | DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, | ||
15 | }; | 13 | }; |
16 | use lsp_types::{ProgressParams, ProgressParamsValue}; | 14 | use lsp_types::{ProgressParams, ProgressParamsValue}; |
17 | use serde::Serialize; | 15 | use serde::Serialize; |
@@ -66,13 +64,10 @@ impl<'a> Project<'a> { | |||
66 | ra_prof::init_from(crate::PROFILE); | 64 | ra_prof::init_from(crate::PROFILE); |
67 | }); | 65 | }); |
68 | 66 | ||
69 | let mut paths = vec![]; | ||
70 | |||
71 | for entry in Fixture::parse(self.fixture) { | 67 | for entry in Fixture::parse(self.fixture) { |
72 | let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]); | 68 | let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]); |
73 | fs::create_dir_all(path.parent().unwrap()).unwrap(); | 69 | fs::create_dir_all(path.parent().unwrap()).unwrap(); |
74 | fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); | 70 | fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); |
75 | paths.push((path, entry.text)); | ||
76 | } | 71 | } |
77 | 72 | ||
78 | let mut roots = | 73 | let mut roots = |
@@ -102,7 +97,7 @@ impl<'a> Project<'a> { | |||
102 | f(&mut config) | 97 | f(&mut config) |
103 | } | 98 | } |
104 | 99 | ||
105 | Server::new(tmp_dir, config, paths) | 100 | Server::new(tmp_dir, config) |
106 | } | 101 | } |
107 | } | 102 | } |
108 | 103 | ||
@@ -120,7 +115,7 @@ pub struct Server { | |||
120 | } | 115 | } |
121 | 116 | ||
122 | impl Server { | 117 | impl Server { |
123 | fn new(dir: TempDir, config: Config, files: Vec<(PathBuf, String)>) -> Server { | 118 | fn new(dir: TempDir, config: Config) -> Server { |
124 | let (connection, client) = Connection::memory(); | 119 | let (connection, client) = Connection::memory(); |
125 | 120 | ||
126 | let _thread = jod_thread::Builder::new() | 121 | let _thread = jod_thread::Builder::new() |
@@ -128,20 +123,7 @@ impl Server { | |||
128 | .spawn(move || main_loop(config, connection).unwrap()) | 123 | .spawn(move || main_loop(config, connection).unwrap()) |
129 | .expect("failed to spawn a thread"); | 124 | .expect("failed to spawn a thread"); |
130 | 125 | ||
131 | let res = | 126 | Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread } |
132 | Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread }; | ||
133 | |||
134 | for (path, text) in files { | ||
135 | res.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams { | ||
136 | text_document: TextDocumentItem { | ||
137 | uri: Url::from_file_path(path).unwrap(), | ||
138 | language_id: "rust".to_string(), | ||
139 | version: 0, | ||
140 | text, | ||
141 | }, | ||
142 | }) | ||
143 | } | ||
144 | res | ||
145 | } | 127 | } |
146 | 128 | ||
147 | pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { | 129 | pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { |