From 10726fdb65fda9144a5f9201272d065a268fc1b7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 10 Apr 2019 10:46:43 +0300 Subject: type-safer source-map for bindings --- crates/ra_ide_api/src/completion/complete_path.rs | 8 +++----- 1 file changed, 3 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 e54fe7b7e..7e47fa6bd 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -1,4 +1,4 @@ -use hir::Resolution; +use hir::{Resolution, Either}; use ra_syntax::AstNode; use test_utils::tested_by; @@ -19,10 +19,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { for (name, res) in module_scope.entries() { if Some(module) == ctx.module { if let Some(import) = res.import { - if let hir::ImportSource::UseTree(tree) = - module.import_source(ctx.db, import) - { - if tree.syntax().range().contains_inclusive(ctx.offset) { + if let Either::A(use_tree) = module.import_source(ctx.db, import) { + if use_tree.syntax().range().contains_inclusive(ctx.offset) { // for `use self::foo<|>`, don't suggest `foo` as a completion tested_by!(dont_complete_current_use); continue; -- cgit v1.2.3