Intern ModPath
in Import
Minor savings only
This commit is contained in:
parent
e2213a503e
commit
f7e6b186e1
@ -529,7 +529,7 @@ impl<N: ItemTreeNode> Index<FileItemTreeId<N>> for ItemTree {
|
||||
/// A desugared `use` import.
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Import {
|
||||
pub path: ModPath,
|
||||
pub path: Interned<ModPath>,
|
||||
pub alias: Option<ImportAlias>,
|
||||
pub visibility: RawVisibilityId,
|
||||
pub is_glob: bool,
|
||||
|
@ -577,7 +577,7 @@ impl Ctx {
|
||||
&self.hygiene,
|
||||
|path, _use_tree, is_glob, alias| {
|
||||
imports.push(id(tree.imports.alloc(Import {
|
||||
path,
|
||||
path: Interned::new(path),
|
||||
alias,
|
||||
visibility,
|
||||
is_glob,
|
||||
|
@ -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<ModPath>,
|
||||
alias: Option<ImportAlias>,
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user