aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/import_map.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/import_map.rs b/crates/ra_hir_def/src/import_map.rs
index 00a5211b1..869f3ca5a 100644
--- a/crates/ra_hir_def/src/import_map.rs
+++ b/crates/ra_hir_def/src/import_map.rs
@@ -5,6 +5,7 @@ use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc};
5use fst::{self, Streamer}; 5use fst::{self, Streamer};
6use indexmap::{map::Entry, IndexMap}; 6use indexmap::{map::Entry, IndexMap};
7use ra_db::CrateId; 7use ra_db::CrateId;
8use ra_syntax::SmolStr;
8use rustc_hash::{FxHashMap, FxHasher}; 9use rustc_hash::{FxHashMap, FxHasher};
9use smallvec::SmallVec; 10use smallvec::SmallVec;
10 11
@@ -50,7 +51,7 @@ pub struct ImportMap {
50 51
51 /// Maps names of associated items to the item's ID. Only includes items whose defining trait is 52 /// Maps names of associated items to the item's ID. Only includes items whose defining trait is
52 /// exported. 53 /// exported.
53 assoc_map: FxHashMap<String, SmallVec<[AssocItemId; 1]>>, 54 assoc_map: FxHashMap<SmolStr, SmallVec<[AssocItemId; 1]>>,
54} 55}
55 56
56impl ImportMap { 57impl ImportMap {
@@ -162,7 +163,7 @@ impl ImportMap {
162 fn collect_trait_methods(&mut self, db: &dyn DefDatabase, tr: TraitId) { 163 fn collect_trait_methods(&mut self, db: &dyn DefDatabase, tr: TraitId) {
163 let data = db.trait_data(tr); 164 let data = db.trait_data(tr);
164 for (name, item) in data.items.iter() { 165 for (name, item) in data.items.iter() {
165 self.assoc_map.entry(name.to_string()).or_default().push(*item); 166 self.assoc_map.entry(name.to_string().into()).or_default().push(*item);
166 } 167 }
167 } 168 }
168} 169}
@@ -310,7 +311,7 @@ pub fn search_dependencies<'a>(
310 311
311 // Add all exported associated items whose names match the query (exactly). 312 // Add all exported associated items whose names match the query (exactly).
312 for map in &import_maps { 313 for map in &import_maps {
313 if let Some(v) = map.assoc_map.get(&query.query) { 314 if let Some(v) = map.assoc_map.get(&*query.query) {
314 res.extend(v.iter().map(|&assoc| { 315 res.extend(v.iter().map(|&assoc| {
315 ItemInNs::Types(match assoc { 316 ItemInNs::Types(match assoc {
316 AssocItemId::FunctionId(it) => it.into(), 317 AssocItemId::FunctionId(it) => it.into(),