diff options
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | crates/ra_assists/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_assists/src/ast_transform.rs | 6 |
3 files changed, 5 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index ba9a201b9..90c505f40 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -872,6 +872,7 @@ dependencies = [ | |||
872 | "ra_hir 0.1.0", | 872 | "ra_hir 0.1.0", |
873 | "ra_syntax 0.1.0", | 873 | "ra_syntax 0.1.0", |
874 | "ra_text_edit 0.1.0", | 874 | "ra_text_edit 0.1.0", |
875 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
875 | "test_utils 0.1.0", | 876 | "test_utils 0.1.0", |
876 | ] | 877 | ] |
877 | 878 | ||
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] |
11 | format-buf = "1.0.0" | 11 | format-buf = "1.0.0" |
12 | join_to_string = "0.1.3" | 12 | join_to_string = "0.1.3" |
13 | rustc-hash = "1.0" | ||
13 | itertools = "0.8.0" | 14 | itertools = "0.8.0" |
14 | 15 | ||
15 | ra_syntax = { path = "../ra_syntax" } | 16 | ra_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. |
2 | use std::collections::HashMap; | 2 | use rustc_hash::FxHashMap; |
3 | 3 | ||
4 | use hir::{db::HirDatabase, InFile, PathResolution}; | 4 | use hir::{db::HirDatabase, InFile, PathResolution}; |
5 | use ra_syntax::ast::{self, make, AstNode}; | 5 | use ra_syntax::ast::{self, make, AstNode}; |
@@ -35,7 +35,7 @@ impl<'a> AstTransform<'a> for NullTransformer { | |||
35 | 35 | ||
36 | pub struct SubstituteTypeParams<'a, DB: HirDatabase> { | 36 | pub 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 |