diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-26 11:32:09 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-26 11:32:09 +0000 |
commit | 6e36eadd261b1f7765bef32ec74899003c5c3517 (patch) | |
tree | 5f05620adde03f7cb521b2f59aad6b2470e6272e /crates/ra_hir_def | |
parent | 500e022f7decbee29a693b0f0dd2f63789a99e5a (diff) | |
parent | a443b5033c2e95ee58bf086f7093ddc610d4f78f (diff) |
Merge #2409
2409: Id-ify Ty::Adt r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 4 |
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, |