aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index d7d62e863..878dc37c8 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -142,20 +142,10 @@ impl Module {
142 Def::Enum(e) => { 142 Def::Enum(e) => {
143 if segments.len() == idx + 1 { 143 if segments.len() == idx + 1 {
144 // enum variant 144 // enum variant
145 let matching_variant = e.variants(db)?.map(|variants| { 145 let matching_variant =
146 variants 146 e.variants(db)?.into_iter().find(|(n, _variant)| n == name);
147 .into_iter() 147
148 // FIXME: replace by match lol 148 if let Some((_n, variant)) = matching_variant {
149 .find(|variant| {
150 variant
151 .name(db)
152 .map(|o| o.map(|ref n| n == name))
153 .unwrap_or(Some(false))
154 .unwrap_or(false)
155 })
156 });
157
158 if let Some(Some(variant)) = matching_variant {
159 return Ok(PerNs::both(variant.def_id(), e.def_id())); 149 return Ok(PerNs::both(variant.def_id(), e.def_id()));
160 } else { 150 } else {
161 return Ok(PerNs::none()); 151 return Ok(PerNs::none());