From dc2b30e9b6084048e441765b91ef830a836d3dfc Mon Sep 17 00:00:00 2001 From: Muhammad Mominul Huque Date: Fri, 12 Oct 2018 00:07:44 +0600 Subject: Replace HashMap, HashSet with FxHashMap and FxHashSet --- crates/ra_editor/src/scope/fn_scope.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'crates/ra_editor/src/scope') diff --git a/crates/ra_editor/src/scope/fn_scope.rs b/crates/ra_editor/src/scope/fn_scope.rs index 65d85279f..9a48bda02 100644 --- a/crates/ra_editor/src/scope/fn_scope.rs +++ b/crates/ra_editor/src/scope/fn_scope.rs @@ -1,7 +1,5 @@ -use std::{ - fmt, - collections::HashMap, -}; +use std::fmt; +use rustc_hash::FxHashMap; use ra_syntax::{ SyntaxNodeRef, SyntaxNode, SmolStr, AstNode, @@ -15,7 +13,7 @@ type ScopeId = usize; pub struct FnScopes { pub self_param: Option, scopes: Vec, - scope_for: HashMap, + scope_for: FxHashMap, } impl FnScopes { @@ -25,7 +23,7 @@ impl FnScopes { .and_then(|it| it.self_param()) .map(|it| it.syntax().owned()), scopes: Vec::new(), - scope_for: HashMap::new() + scope_for: FxHashMap::default() }; let root = scopes.root_scope(); scopes.add_params_bindings(root, fn_def.param_list()); @@ -242,9 +240,9 @@ struct ScopeData { } pub fn resolve_local_name<'a>(name_ref: ast::NameRef, scopes: &'a FnScopes) -> Option<&'a ScopeEntry> { - use std::collections::HashSet; + use rustc_hash::FxHashSet; - let mut shadowed = HashSet::new(); + let mut shadowed = FxHashSet::default(); let ret = scopes.scope_chain(name_ref.syntax()) .flat_map(|scope| scopes.entries(scope).iter()) .filter(|entry| shadowed.insert(entry.name())) -- cgit v1.2.3