diff options
author | Muhammad Mominul Huque <[email protected]> | 2018-10-11 19:07:44 +0100 |
---|---|---|
committer | Muhammad Mominul Huque <[email protected]> | 2018-10-11 19:07:44 +0100 |
commit | dc2b30e9b6084048e441765b91ef830a836d3dfc (patch) | |
tree | d36cc20ef7c43d33488706cd65427e5d8922430c /crates/ra_lsp_server/src/main_loop | |
parent | 9b155c89764b8413df6b32edfde94fce1d9c15ec (diff) |
Replace HashMap, HashSet with FxHashMap and FxHashSet
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/mod.rs | 12 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/subscriptions.rs | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 725036cc7..ab8be15e9 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::collections::{HashMap}; | 1 | use rustc_hash::FxHashMap; |
2 | 2 | ||
3 | use languageserver_types::{ | 3 | use languageserver_types::{ |
4 | Diagnostic, DiagnosticSeverity, DocumentSymbol, | 4 | Diagnostic, DiagnosticSeverity, DocumentSymbol, |
@@ -267,7 +267,7 @@ pub fn handle_runnables( | |||
267 | bin: "cargo".to_string(), | 267 | bin: "cargo".to_string(), |
268 | args, | 268 | args, |
269 | env: { | 269 | env: { |
270 | let mut m = HashMap::new(); | 270 | let mut m = FxHashMap::default(); |
271 | m.insert( | 271 | m.insert( |
272 | "RUST_BACKTRACE".to_string(), | 272 | "RUST_BACKTRACE".to_string(), |
273 | "short".to_string(), | 273 | "short".to_string(), |
diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index 53c6f1dff..402615e42 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs | |||
@@ -3,7 +3,6 @@ mod subscriptions; | |||
3 | 3 | ||
4 | use std::{ | 4 | use std::{ |
5 | path::PathBuf, | 5 | path::PathBuf, |
6 | collections::{HashMap}, | ||
7 | }; | 6 | }; |
8 | 7 | ||
9 | use serde::{Serialize, de::DeserializeOwned}; | 8 | use serde::{Serialize, de::DeserializeOwned}; |
@@ -15,6 +14,7 @@ use gen_lsp_server::{ | |||
15 | RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode, | 14 | RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode, |
16 | handle_shutdown, | 15 | handle_shutdown, |
17 | }; | 16 | }; |
17 | use rustc_hash::FxHashMap; | ||
18 | 18 | ||
19 | use { | 19 | use { |
20 | req, | 20 | req, |
@@ -50,7 +50,7 @@ pub fn main_loop( | |||
50 | info!("server initialized, serving requests"); | 50 | info!("server initialized, serving requests"); |
51 | let mut state = ServerWorldState::new(); | 51 | let mut state = ServerWorldState::new(); |
52 | 52 | ||
53 | let mut pending_requests = HashMap::new(); | 53 | let mut pending_requests = FxHashMap::default(); |
54 | let mut subs = Subscriptions::new(); | 54 | let mut subs = Subscriptions::new(); |
55 | let main_res = main_loop_inner( | 55 | let main_res = main_loop_inner( |
56 | internal_mode, | 56 | internal_mode, |
@@ -95,7 +95,7 @@ fn main_loop_inner( | |||
95 | fs_worker: Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, | 95 | fs_worker: Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, |
96 | ws_worker: Worker<PathBuf, Result<CargoWorkspace>>, | 96 | ws_worker: Worker<PathBuf, Result<CargoWorkspace>>, |
97 | state: &mut ServerWorldState, | 97 | state: &mut ServerWorldState, |
98 | pending_requests: &mut HashMap<u64, JobHandle>, | 98 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
99 | subs: &mut Subscriptions, | 99 | subs: &mut Subscriptions, |
100 | ) -> Result<()> { | 100 | ) -> Result<()> { |
101 | let (libdata_sender, libdata_receiver) = unbounded(); | 101 | let (libdata_sender, libdata_receiver) = unbounded(); |
@@ -213,7 +213,7 @@ fn main_loop_inner( | |||
213 | fn on_task( | 213 | fn on_task( |
214 | task: Task, | 214 | task: Task, |
215 | msg_sender: &Sender<RawMessage>, | 215 | msg_sender: &Sender<RawMessage>, |
216 | pending_requests: &mut HashMap<u64, JobHandle>, | 216 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
217 | ) { | 217 | ) { |
218 | match task { | 218 | match task { |
219 | Task::Respond(response) => { | 219 | Task::Respond(response) => { |
@@ -229,7 +229,7 @@ fn on_task( | |||
229 | 229 | ||
230 | fn on_request( | 230 | fn on_request( |
231 | world: &mut ServerWorldState, | 231 | world: &mut ServerWorldState, |
232 | pending_requests: &mut HashMap<u64, JobHandle>, | 232 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
233 | pool: &ThreadPool, | 233 | pool: &ThreadPool, |
234 | sender: &Sender<Task>, | 234 | sender: &Sender<Task>, |
235 | req: RawRequest, | 235 | req: RawRequest, |
@@ -269,7 +269,7 @@ fn on_request( | |||
269 | fn on_notification( | 269 | fn on_notification( |
270 | msg_sender: &Sender<RawMessage>, | 270 | msg_sender: &Sender<RawMessage>, |
271 | state: &mut ServerWorldState, | 271 | state: &mut ServerWorldState, |
272 | pending_requests: &mut HashMap<u64, JobHandle>, | 272 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
273 | subs: &mut Subscriptions, | 273 | subs: &mut Subscriptions, |
274 | not: RawNotification, | 274 | not: RawNotification, |
275 | ) -> Result<()> { | 275 | ) -> Result<()> { |
diff --git a/crates/ra_lsp_server/src/main_loop/subscriptions.rs b/crates/ra_lsp_server/src/main_loop/subscriptions.rs index 27f92cc9a..310153382 100644 --- a/crates/ra_lsp_server/src/main_loop/subscriptions.rs +++ b/crates/ra_lsp_server/src/main_loop/subscriptions.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | use std::collections::HashSet; | 1 | use rustc_hash::FxHashSet; |
2 | use ra_analysis::FileId; | 2 | use ra_analysis::FileId; |
3 | 3 | ||
4 | pub struct Subscriptions { | 4 | pub struct Subscriptions { |
5 | subs: HashSet<FileId>, | 5 | subs: FxHashSet<FileId>, |
6 | } | 6 | } |
7 | 7 | ||
8 | impl Subscriptions { | 8 | impl Subscriptions { |
9 | pub fn new() -> Subscriptions { | 9 | pub fn new() -> Subscriptions { |
10 | Subscriptions { subs: HashSet::new() } | 10 | Subscriptions { subs: FxHashSet::default() } |
11 | } | 11 | } |
12 | pub fn add_sub(&mut self, file_id: FileId) { | 12 | pub fn add_sub(&mut self, file_id: FileId) { |
13 | self.subs.insert(file_id); | 13 | self.subs.insert(file_id); |