aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-01-10 17:59:57 +0000
committerFlorian Diebold <[email protected]>2020-01-11 22:33:04 +0000
commitccb75f7c979b56bc62b61fadd81903e11a7f5d74 (patch)
treed6a07ac82e23309410d6ecba894c2a0dfc63d0f0 /crates
parent4496e2a06a91e5825f355ce730af802643e8018a (diff)
Use FxHashMap
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/Cargo.toml1
-rw-r--r--crates/ra_assists/src/ast_transform.rs6
2 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml
index 434e6656c..50be8d9bc 100644
--- a/crates/ra_assists/Cargo.toml
+++ b/crates/ra_assists/Cargo.toml
@@ -10,6 +10,7 @@ doctest = false
10[dependencies] 10[dependencies]
11format-buf = "1.0.0" 11format-buf = "1.0.0"
12join_to_string = "0.1.3" 12join_to_string = "0.1.3"
13rustc-hash = "1.0"
13itertools = "0.8.0" 14itertools = "0.8.0"
14 15
15ra_syntax = { path = "../ra_syntax" } 16ra_syntax = { path = "../ra_syntax" }
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index ace59f290..cbddc50ac 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -1,5 +1,5 @@
1//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined. 1//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined.
2use std::collections::HashMap; 2use rustc_hash::FxHashMap;
3 3
4use hir::{db::HirDatabase, InFile, PathResolution}; 4use hir::{db::HirDatabase, InFile, PathResolution};
5use ra_syntax::ast::{self, make, AstNode}; 5use ra_syntax::ast::{self, make, AstNode};
@@ -35,7 +35,7 @@ impl<'a> AstTransform<'a> for NullTransformer {
35 35
36pub struct SubstituteTypeParams<'a, DB: HirDatabase> { 36pub struct SubstituteTypeParams<'a, DB: HirDatabase> {
37 db: &'a DB, 37 db: &'a DB,
38 substs: HashMap<hir::TypeParam, ast::TypeRef>, 38 substs: FxHashMap<hir::TypeParam, ast::TypeRef>,
39 previous: Box<dyn AstTransform<'a> + 'a>, 39 previous: Box<dyn AstTransform<'a> + 'a>,
40} 40}
41 41
@@ -47,7 +47,7 @@ impl<'a, DB: HirDatabase> SubstituteTypeParams<'a, DB> {
47 ) -> SubstituteTypeParams<'a, DB> { 47 ) -> SubstituteTypeParams<'a, DB> {
48 let substs = get_syntactic_substs(impl_block).unwrap_or_default(); 48 let substs = get_syntactic_substs(impl_block).unwrap_or_default();
49 let generic_def: hir::GenericDef = trait_.into(); 49 let generic_def: hir::GenericDef = trait_.into();
50 let substs_by_param: HashMap<_, _> = generic_def 50 let substs_by_param: FxHashMap<_, _> = generic_def
51 .params(db) 51 .params(db)
52 .into_iter() 52 .into_iter()
53 // this is a trait impl, so we need to skip the first type parameter -- this is a bit hacky 53 // this is a trait impl, so we need to skip the first type parameter -- this is a bit hacky