aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-03 19:56:53 +0100
committerJonas Schievink <[email protected]>2021-04-03 19:57:25 +0100
commitf7e6b186e1d2f3a31b8e21d0885e13f12f12d71b (patch)
tree9d7a2c08e173ee9bf20cd09ca068ff3de83489f4 /crates/hir_def/src/nameres
parente2213a503ec4c602eb976dccb9d34b56d9c6aba3 (diff)
Intern `ModPath` in `Import`
Minor savings only
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r--crates/hir_def/src/nameres/collector.rs8
1 files changed, 6 insertions, 2 deletions
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::{
23 attr::Attrs, 23 attr::Attrs,
24 db::DefDatabase, 24 db::DefDatabase,
25 derive_macro_as_call_id, 25 derive_macro_as_call_id,
26 intern::Interned,
26 item_scope::{ImportType, PerNsGlobImports}, 27 item_scope::{ImportType, PerNsGlobImports},
27 item_tree::{ 28 item_tree::{
28 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroDef, MacroRules, Mod, ModItem, 29 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroDef, MacroRules, Mod, ModItem,
@@ -139,7 +140,7 @@ enum ImportSource {
139 140
140#[derive(Clone, Debug, Eq, PartialEq)] 141#[derive(Clone, Debug, Eq, PartialEq)]
141struct Import { 142struct Import {
142 path: ModPath, 143 path: Interned<ModPath>,
143 alias: Option<ImportAlias>, 144 alias: Option<ImportAlias>,
144 visibility: RawVisibility, 145 visibility: RawVisibility,
145 is_glob: bool, 146 is_glob: bool,
@@ -181,7 +182,10 @@ impl Import {
181 let attrs = &tree.attrs(db, krate, ModItem::from(id.value).into()); 182 let attrs = &tree.attrs(db, krate, ModItem::from(id.value).into());
182 let visibility = &tree[it.visibility]; 183 let visibility = &tree[it.visibility];
183 Self { 184 Self {
184 path: ModPath::from_segments(PathKind::Plain, iter::once(it.name.clone())), 185 path: Interned::new(ModPath::from_segments(
186 PathKind::Plain,
187 iter::once(it.name.clone()),
188 )),
185 alias: it.alias.clone(), 189 alias: it.alias.clone(),
186 visibility: visibility.clone(), 190 visibility: visibility.clone(),
187 is_glob: false, 191 is_glob: false,