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.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index 0091bfbc3..0cf418d30 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -129,6 +129,10 @@ impl VariantData {
129 } 129 }
130 } 130 }
131 131
132 pub fn field(&self, name: &Name) -> Option<LocalStructFieldId> {
133 self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None })
134 }
135
132 pub fn is_unit(&self) -> bool { 136 pub fn is_unit(&self) -> bool {
133 match self { 137 match self {
134 VariantData::Unit => true, 138 VariantData::Unit => true,