@@ -5,6 +5,7 @@ use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc};
55use fst:: { self , Streamer } ;
66use indexmap:: { map:: Entry , IndexMap } ;
77use ra_db:: CrateId ;
8+ use ra_syntax:: SmolStr ;
89use rustc_hash:: { FxHashMap , FxHasher } ;
910use smallvec:: SmallVec ;
1011
@@ -50,7 +51,7 @@ pub struct ImportMap {
5051
5152 /// Maps names of associated items to the item's ID. Only includes items whose defining trait is
5253 /// exported.
53- assoc_map : FxHashMap < String , SmallVec < [ AssocItemId ; 1 ] > > ,
54+ assoc_map : FxHashMap < SmolStr , SmallVec < [ AssocItemId ; 1 ] > > ,
5455}
5556
5657impl ImportMap {
@@ -162,7 +163,7 @@ impl ImportMap {
162163 fn collect_trait_methods ( & mut self , db : & dyn DefDatabase , tr : TraitId ) {
163164 let data = db. trait_data ( tr) ;
164165 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) ;
166167 }
167168 }
168169}
@@ -310,7 +311,7 @@ pub fn search_dependencies<'a>(
310311
311312 // Add all exported associated items whose names match the query (exactly).
312313 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 ) {
314315 res. extend ( v. iter ( ) . map ( |& assoc| {
315316 ItemInNs :: Types ( match assoc {
316317 AssocItemId :: FunctionId ( it) => it. into ( ) ,
0 commit comments