aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-26 10:43:07 +0100
committerAleksey Kladov <[email protected]>2020-06-26 10:43:07 +0100
commit751b8792a2db3a744b22f5261d4136e671b14835 (patch)
tree08e0d2b25f0c177aa99a3eed1377a78f4c4457f4
parent34118779ecd315efd2e17d0a055c3afc8ed0fed6 (diff)
Simplify
-rw-r--r--crates/rust-analyzer/src/global_state.rs8
-rw-r--r--crates/rust-analyzer/src/main_loop.rs4
2 files changed, 2 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 5b6c7922d..6a5ba138f 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -170,14 +170,6 @@ impl GlobalState {
170 } 170 }
171 } 171 }
172 172
173 pub(crate) fn maybe_collect_garbage(&mut self) {
174 self.analysis_host.maybe_collect_garbage()
175 }
176
177 pub(crate) fn collect_garbage(&mut self) {
178 self.analysis_host.collect_garbage()
179 }
180
181 pub(crate) fn send(&mut self, message: lsp_server::Message) { 173 pub(crate) fn send(&mut self, message: lsp_server::Message) {
182 self.sender.send(message).unwrap() 174 self.sender.send(message).unwrap()
183 } 175 }
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 386a47621..162c0057e 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -158,7 +158,7 @@ impl GlobalState {
158 } 158 }
159 Task::Unit => (), 159 Task::Unit => (),
160 } 160 }
161 self.maybe_collect_garbage(); 161 self.analysis_host.maybe_collect_garbage();
162 } 162 }
163 Event::Vfs(task) => match task { 163 Event::Vfs(task) => match task {
164 vfs::loader::Message::Loaded { files } => { 164 vfs::loader::Message::Loaded { files } => {
@@ -274,7 +274,7 @@ impl GlobalState {
274 self.req_queue.incoming.register(req.id.clone(), (req.method.clone(), request_received)); 274 self.req_queue.incoming.register(req.id.clone(), (req.method.clone(), request_received));
275 275
276 RequestDispatcher { req: Some(req), global_state: self } 276 RequestDispatcher { req: Some(req), global_state: self }
277 .on_sync::<lsp_ext::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))? 277 .on_sync::<lsp_ext::CollectGarbage>(|s, ()| Ok(s.analysis_host.collect_garbage()))?
278 .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? 278 .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
279 .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? 279 .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
280 .on_sync::<lsp_types::request::Shutdown>(|_, ()| Ok(()))? 280 .on_sync::<lsp_types::request::Shutdown>(|_, ()| Ok(()))?