Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres/path_resolution.rs')
-rw-r--r--crates/hir-def/src/nameres/path_resolution.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/hir-def/src/nameres/path_resolution.rs b/crates/hir-def/src/nameres/path_resolution.rs
index cf33cecf5f..54fd30fe6b 100644
--- a/crates/hir-def/src/nameres/path_resolution.rs
+++ b/crates/hir-def/src/nameres/path_resolution.rs
@@ -519,12 +519,8 @@ impl DefMap {
// enum variant
cov_mark::hit!(can_import_enum_variant);
- let res = e
- .enum_variants(db)
- .variants
- .iter()
- .find(|(_, name, _)| name == segment)
- .map(|&(variant, _, shape)| match shape {
+ let res = e.enum_variants(db).variants.get(segment).map(|&(variant, shape)| {
+ match shape {
FieldsShape::Record => {
PerNs::types(variant.into(), Visibility::Public, None)
}
@@ -534,7 +530,8 @@ impl DefMap {
Visibility::Public,
None,
),
- });
+ }
+ });
// FIXME: Need to filter visibility here and below? Not sure.
return match res {
Some(res) => {