diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-10 19:12:40 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-10 19:12:40 +0000 |
commit | dc2a8d5acc53054c86ad17260b69d4bf4f14dbc6 (patch) | |
tree | ddf2dbe793448d3e913f869c7dab91ce7175b623 /crates/ra_ide_api/src/completion | |
parent | a95536301c346e68a109915e6d54136cae875ab0 (diff) | |
parent | e78286c8e88d31045d354320a1d29bbd75405027 (diff) |
Merge #470
470: Type inference for enum variants r=flodiebold a=marcusklaas
Opened a new PR instead of https://github.com/rust-analyzer/rust-analyzer/pull/461. Totally botched that one.
I think I resolved all the issues mentioned there.
Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 2494d28ed..4860db629 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -21,14 +21,15 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C | |||
21 | .add_to(acc) | 21 | .add_to(acc) |
22 | }); | 22 | }); |
23 | } | 23 | } |
24 | hir::Def::Enum(e) => e | 24 | hir::Def::Enum(e) => { |
25 | .variants(ctx.db)? | 25 | e.variants(ctx.db)? |
26 | .into_iter() | 26 | .into_iter() |
27 | .for_each(|(name, _variant)| { | 27 | .for_each(|(variant_name, _variant)| { |
28 | CompletionItem::new(CompletionKind::Reference, name.to_string()) | 28 | CompletionItem::new(CompletionKind::Reference, variant_name.to_string()) |
29 | .kind(CompletionItemKind::EnumVariant) | 29 | .kind(CompletionItemKind::EnumVariant) |
30 | .add_to(acc) | 30 | .add_to(acc) |
31 | }), | 31 | }); |
32 | } | ||
32 | _ => return Ok(()), | 33 | _ => return Ok(()), |
33 | }; | 34 | }; |
34 | Ok(()) | 35 | Ok(()) |