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 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_ide_api/src/completion') 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, }; -- cgit v1.2.3