Skip to content

Commit 6ee73cd

Browse files
author
Jonas Schievink
committed
Use SmolStr
1 parent 361b399 commit 6ee73cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/ra_hir_def/src/import_map.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc};
55
use fst::{self, Streamer};
66
use indexmap::{map::Entry, IndexMap};
77
use ra_db::CrateId;
8+
use ra_syntax::SmolStr;
89
use rustc_hash::{FxHashMap, FxHasher};
910
use 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

5657
impl 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

Comments
 (0)