From 6ee73cd334d927e6ff4b7225d653dacca3293ae5 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 2 Jul 2020 15:42:37 +0200 Subject: Use SmolStr --- crates/ra_hir_def/src/import_map.rs | 7 ++++--- 1 file 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}; use fst::{self, Streamer}; use indexmap::{map::Entry, IndexMap}; use ra_db::CrateId; +use ra_syntax::SmolStr; use rustc_hash::{FxHashMap, FxHasher}; use smallvec::SmallVec; @@ -50,7 +51,7 @@ pub struct ImportMap { /// Maps names of associated items to the item's ID. Only includes items whose defining trait is /// exported. - assoc_map: FxHashMap>, + assoc_map: FxHashMap>, } impl ImportMap { @@ -162,7 +163,7 @@ impl ImportMap { fn collect_trait_methods(&mut self, db: &dyn DefDatabase, tr: TraitId) { let data = db.trait_data(tr); for (name, item) in data.items.iter() { - self.assoc_map.entry(name.to_string()).or_default().push(*item); + self.assoc_map.entry(name.to_string().into()).or_default().push(*item); } } } @@ -310,7 +311,7 @@ pub fn search_dependencies<'a>( // Add all exported associated items whose names match the query (exactly). for map in &import_maps { - if let Some(v) = map.assoc_map.get(&query.query) { + if let Some(v) = map.assoc_map.get(&*query.query) { res.extend(v.iter().map(|&assoc| { ItemInNs::Types(match assoc { AssocItemId::FunctionId(it) => it.into(), -- cgit v1.2.3