From f7e6b186e1d2f3a31b8e21d0885e13f12f12d71b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 3 Apr 2021 20:56:53 +0200 Subject: Intern `ModPath` in `Import` Minor savings only --- crates/hir_def/src/nameres/collector.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/hir_def/src/nameres') diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index c8f494707..c2e445b68 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -23,6 +23,7 @@ use crate::{ attr::Attrs, db::DefDatabase, derive_macro_as_call_id, + intern::Interned, item_scope::{ImportType, PerNsGlobImports}, item_tree::{ self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroDef, MacroRules, Mod, ModItem, @@ -139,7 +140,7 @@ enum ImportSource { #[derive(Clone, Debug, Eq, PartialEq)] struct Import { - path: ModPath, + path: Interned, alias: Option, visibility: RawVisibility, is_glob: bool, @@ -181,7 +182,10 @@ impl Import { let attrs = &tree.attrs(db, krate, ModItem::from(id.value).into()); let visibility = &tree[it.visibility]; Self { - path: ModPath::from_segments(PathKind::Plain, iter::once(it.name.clone())), + path: Interned::new(ModPath::from_segments( + PathKind::Plain, + iter::once(it.name.clone()), + )), alias: it.alias.clone(), visibility: visibility.clone(), is_glob: false, -- cgit v1.2.3