aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/adt.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index a43f553aa..c9f30923e 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -109,10 +109,18 @@ impl VariantData {
109 } 109 }
110 } 110 }
111 111
112 pub fn fields(&self) -> Option<&Arena<LocalStructFieldId, StructFieldData>> { 112 pub fn fields(&self) -> &Arena<LocalStructFieldId, StructFieldData> {
113 const EMPTY: &Arena<LocalStructFieldId, StructFieldData> = &Arena::new();
113 match &self { 114 match &self {
114 VariantData::Record(fields) | VariantData::Tuple(fields) => Some(fields), 115 VariantData::Record(fields) | VariantData::Tuple(fields) => fields,
115 _ => None, 116 _ => EMPTY,
117 }
118 }
119
120 pub fn is_unit(&self) -> bool {
121 match self {
122 VariantData::Unit => true,
123 _ => false,
116 } 124 }
117 } 125 }
118} 126}