From 87288d802c3cad7ec50c508276b89a8c454f336c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 12:41:23 +0300 Subject: pack enum variants into arena --- crates/ra_ide_api/src/completion/complete_path.rs | 10 +++++----- crates/ra_ide_api/src/db.rs | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide_api') diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index e72586e2e..e3f1d42f8 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -27,18 +27,18 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { } } hir::ModuleDef::Enum(e) => { - e.variants(ctx.db) - .into_iter() - .for_each(|(variant_name, variant)| { + e.variants(ctx.db).into_iter().for_each(|variant| { + if let Some(name) = variant.name(ctx.db) { CompletionItem::new( CompletionKind::Reference, ctx.source_range(), - variant_name.to_string(), + name.to_string(), ) .kind(CompletionItemKind::EnumVariant) .set_documentation(variant.docs(ctx.db)) .add_to(acc) - }); + } + }); } _ => return, }; diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index bff6b7237..11305613c 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -104,7 +104,6 @@ salsa::database_storage! { fn type_for_field() for hir::db::TypeForFieldQuery; fn struct_data() for hir::db::StructDataQuery; fn enum_data() for hir::db::EnumDataQuery; - fn enum_variant_data() for hir::db::EnumVariantDataQuery; fn impls_in_module() for hir::db::ImplsInModuleQuery; fn impls_in_crate() for hir::db::ImplsInCrateQuery; fn body_hir() for hir::db::BodyHirQuery; -- cgit v1.2.3