aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/raw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres/raw.rs')
-rw-r--r--crates/ra_hir/src/nameres/raw.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index 623b343c4..5f93f920f 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -121,14 +121,20 @@ impl Index<Macro> for RawItems {
121} 121}
122 122
123// Avoid heap allocation on items without attributes. 123// Avoid heap allocation on items without attributes.
124pub(super) type Attrs = Option<Arc<[Attr]>>; 124type Attrs = Option<Arc<[Attr]>>;
125 125
126#[derive(Debug, PartialEq, Eq, Clone)] 126#[derive(Debug, PartialEq, Eq, Clone)]
127pub(super) struct RawItem { 127pub(super) struct RawItem {
128 pub(super) attrs: Attrs, 128 attrs: Attrs,
129 pub(super) kind: RawItemKind, 129 pub(super) kind: RawItemKind,
130} 130}
131 131
132impl RawItem {
133 pub(super) fn attrs(&self) -> &[Attr] {
134 self.attrs.as_ref().map_or(&[], |it| &*it)
135 }
136}
137
132#[derive(Debug, PartialEq, Eq, Clone, Copy)] 138#[derive(Debug, PartialEq, Eq, Clone, Copy)]
133pub(super) enum RawItemKind { 139pub(super) enum RawItemKind {
134 Module(Module), 140 Module(Module),