diff options
author | Aleksey Kladov <[email protected]> | 2019-01-25 09:41:23 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-25 09:50:46 +0000 |
commit | 87288d802c3cad7ec50c508276b89a8c454f336c (patch) | |
tree | b9dcccf99c868b6b2abf75e08fc56f42869b9ce5 /crates/ra_ide_api/src/completion | |
parent | c4a351b736632f0c01d9c51ce1cd3b4b4c6194d9 (diff) |
pack enum variants into arena
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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) { | |||
27 | } | 27 | } |
28 | } | 28 | } |
29 | hir::ModuleDef::Enum(e) => { | 29 | hir::ModuleDef::Enum(e) => { |
30 | e.variants(ctx.db) | 30 | e.variants(ctx.db).into_iter().for_each(|variant| { |
31 | .into_iter() | 31 | if let Some(name) = variant.name(ctx.db) { |
32 | .for_each(|(variant_name, variant)| { | ||
33 | CompletionItem::new( | 32 | CompletionItem::new( |
34 | CompletionKind::Reference, | 33 | CompletionKind::Reference, |
35 | ctx.source_range(), | 34 | ctx.source_range(), |
36 | variant_name.to_string(), | 35 | name.to_string(), |
37 | ) | 36 | ) |
38 | .kind(CompletionItemKind::EnumVariant) | 37 | .kind(CompletionItemKind::EnumVariant) |
39 | .set_documentation(variant.docs(ctx.db)) | 38 | .set_documentation(variant.docs(ctx.db)) |
40 | .add_to(acc) | 39 | .add_to(acc) |
41 | }); | 40 | } |
41 | }); | ||
42 | } | 42 | } |
43 | _ => return, | 43 | _ => return, |
44 | }; | 44 | }; |