diff options
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index aac5f3e15..4582c7314 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -140,6 +140,13 @@ impl VariantData { | |||
140 | self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None }) | 140 | self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None }) |
141 | } | 141 | } |
142 | 142 | ||
143 | pub fn kind(&self) -> StructKind { | ||
144 | match self { | ||
145 | VariantData::Record(_) => StructKind::Record, | ||
146 | VariantData::Tuple(_) => StructKind::Tuple, | ||
147 | VariantData::Unit => StructKind::Unit, | ||
148 | } | ||
149 | } | ||
143 | pub fn is_unit(&self) -> bool { | 150 | pub fn is_unit(&self) -> bool { |
144 | match self { | 151 | match self { |
145 | VariantData::Unit => true, | 152 | VariantData::Unit => true, |
@@ -173,7 +180,7 @@ impl HasChildSource for VariantId { | |||
173 | } | 180 | } |
174 | } | 181 | } |
175 | 182 | ||
176 | enum StructKind { | 183 | pub enum StructKind { |
177 | Tuple, | 184 | Tuple, |
178 | Record, | 185 | Record, |
179 | Unit, | 186 | Unit, |