diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/raw.rs')
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 10 |
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. |
124 | pub(super) type Attrs = Option<Arc<[Attr]>>; | 124 | type Attrs = Option<Arc<[Attr]>>; |
125 | 125 | ||
126 | #[derive(Debug, PartialEq, Eq, Clone)] | 126 | #[derive(Debug, PartialEq, Eq, Clone)] |
127 | pub(super) struct RawItem { | 127 | pub(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 | ||
132 | impl 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)] |
133 | pub(super) enum RawItemKind { | 139 | pub(super) enum RawItemKind { |
134 | Module(Module), | 140 | Module(Module), |