aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/db
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-11 19:28:44 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-11 19:28:44 +0100
commit2ba6f18586d02a6dbc32e0bea88f7b4236277ea1 (patch)
tree59bccb90d4b311ffd5c6adc5934fae91c0fb7740 /crates/ra_analysis/src/db
parent77e9bf9b5fdcd4262e2d9badb42b912f5728d90b (diff)
parentdc2b30e9b6084048e441765b91ef830a836d3dfc (diff)
Merge #122
122: Use rustc-hash crate r=matklad a=mominul Replace std's HashMap, HashSet with FxHashMap and FxHashSet. Closes #121 Thanks! Co-authored-by: Muhammad Mominul Huque <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/db')
-rw-r--r--crates/ra_analysis/src/db/imp.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/db/imp.rs b/crates/ra_analysis/src/db/imp.rs
index f26be1046..36f6cf290 100644
--- a/crates/ra_analysis/src/db/imp.rs
+++ b/crates/ra_analysis/src/db/imp.rs
@@ -2,9 +2,10 @@ use std::{
2 sync::Arc, 2 sync::Arc,
3 any::Any, 3 any::Any,
4 hash::{Hash, Hasher}, 4 hash::{Hash, Hasher},
5 collections::hash_map::{DefaultHasher, HashMap}, 5 collections::hash_map::{DefaultHasher},
6 iter, 6 iter,
7}; 7};
8use rustc_hash::FxHashMap;
8use salsa; 9use salsa;
9use {FileId, imp::FileResolverImp}; 10use {FileId, imp::FileResolverImp};
10use super::{State, Query, QueryCtx}; 11use super::{State, Query, QueryCtx};
@@ -13,7 +14,7 @@ pub(super) type Data = Arc<Any + Send + Sync + 'static>;
13 14
14#[derive(Debug)] 15#[derive(Debug)]
15pub(super) struct Db { 16pub(super) struct Db {
16 names: Arc<HashMap<salsa::QueryTypeId, &'static str>>, 17 names: Arc<FxHashMap<salsa::QueryTypeId, &'static str>>,
17 pub(super) imp: salsa::Db<State, Data>, 18 pub(super) imp: salsa::Db<State, Data>,
18} 19}
19 20
@@ -85,7 +86,7 @@ where
85 86
86pub(super) struct QueryRegistry { 87pub(super) struct QueryRegistry {
87 config: Option<salsa::QueryConfig<State, Data>>, 88 config: Option<salsa::QueryConfig<State, Data>>,
88 names: HashMap<salsa::QueryTypeId, &'static str>, 89 names: FxHashMap<salsa::QueryTypeId, &'static str>,
89} 90}
90 91
91impl QueryRegistry { 92impl QueryRegistry {
@@ -109,7 +110,7 @@ impl QueryRegistry {
109 (Arc::new(res), fingerprint) 110 (Arc::new(res), fingerprint)
110 }) 111 })
111 ); 112 );
112 let mut names = HashMap::new(); 113 let mut names = FxHashMap::default();
113 names.insert(FILE_TEXT, "FILE_TEXT"); 114 names.insert(FILE_TEXT, "FILE_TEXT");
114 names.insert(FILE_SET, "FILE_SET"); 115 names.insert(FILE_SET, "FILE_SET");
115 QueryRegistry { config: Some(config), names } 116 QueryRegistry { config: Some(config), names }