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_analysis/src/imp.rs | |
parent | 9b155c89764b8413df6b32edfde94fce1d9c15ec (diff) |
Replace HashMap, HashSet with FxHashMap and FxHashSet
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 517867e86..47bc0032b 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -4,11 +4,12 @@ use std::{ | |||
4 | atomic::{AtomicBool, Ordering::SeqCst}, | 4 | atomic::{AtomicBool, Ordering::SeqCst}, |
5 | }, | 5 | }, |
6 | fmt, | 6 | fmt, |
7 | collections::{HashSet, VecDeque}, | 7 | collections::VecDeque, |
8 | iter, | 8 | iter, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | use relative_path::RelativePath; | 11 | use relative_path::RelativePath; |
12 | use rustc_hash::FxHashSet; | ||
12 | use ra_editor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit, resolve_local_name}; | 13 | use ra_editor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit, resolve_local_name}; |
13 | use ra_syntax::{ | 14 | use ra_syntax::{ |
14 | TextUnit, TextRange, SmolStr, File, AstNode, | 15 | TextUnit, TextRange, SmolStr, File, AstNode, |
@@ -84,7 +85,7 @@ impl AnalysisHostImpl { | |||
84 | data.root = Arc::new(data.root.apply_changes(&mut iter::empty(), Some(resolver))); | 85 | data.root = Arc::new(data.root.apply_changes(&mut iter::empty(), Some(resolver))); |
85 | } | 86 | } |
86 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { | 87 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { |
87 | let mut visited = HashSet::new(); | 88 | let mut visited = FxHashSet::default(); |
88 | for &file_id in graph.crate_roots.values() { | 89 | for &file_id in graph.crate_roots.values() { |
89 | if !visited.insert(file_id) { | 90 | if !visited.insert(file_id) { |
90 | panic!("duplicate crate root: {:?}", file_id); | 91 | panic!("duplicate crate root: {:?}", file_id); |
@@ -168,7 +169,7 @@ impl AnalysisImpl { | |||
168 | let mut res = Vec::new(); | 169 | let mut res = Vec::new(); |
169 | let mut work = VecDeque::new(); | 170 | let mut work = VecDeque::new(); |
170 | work.push_back(file_id); | 171 | work.push_back(file_id); |
171 | let mut visited = HashSet::new(); | 172 | let mut visited = FxHashSet::default(); |
172 | while let Some(id) = work.pop_front() { | 173 | while let Some(id) = work.pop_front() { |
173 | if let Some(crate_id) = crate_graph.crate_id_for_crate_root(id) { | 174 | if let Some(crate_id) = crate_graph.crate_id_for_crate_root(id) { |
174 | res.push(crate_id); | 175 | res.push(crate_id); |