aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-10 08:50:57 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-10 08:50:57 +0100
commit37eb12f2dd6f36570a27b4e4aaf9048860b5a06b (patch)
treef5640991cbf0db2bfdad29b911435827cadfb4a8 /crates/ra_ide_api/src/completion
parentb863272899a1bae63c7d9411d0ebff74652bae8e (diff)
parent10726fdb65fda9144a5f9201272d065a268fc1b7 (diff)
Merge #1128
1128: A touch of type-safety r=matklad a=matklad Note that we intentionally don't use `Either` from crates.io: I like A/B naming more then left/rigth, I feel like we might need Either3 with C at some point, and I'd love the ability to write inherent impls Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs8
1 files changed, 3 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 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 @@
1use hir::Resolution; 1use hir::{Resolution, Either};
2use ra_syntax::AstNode; 2use ra_syntax::AstNode;
3use test_utils::tested_by; 3use test_utils::tested_by;
4 4
@@ -19,10 +19,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
19 for (name, res) in module_scope.entries() { 19 for (name, res) in module_scope.entries() {
20 if Some(module) == ctx.module { 20 if Some(module) == ctx.module {
21 if let Some(import) = res.import { 21 if let Some(import) = res.import {
22 if let hir::ImportSource::UseTree(tree) = 22 if let Either::A(use_tree) = module.import_source(ctx.db, import) {
23 module.import_source(ctx.db, import) 23 if use_tree.syntax().range().contains_inclusive(ctx.offset) {
24 {
25 if tree.syntax().range().contains_inclusive(ctx.offset) {
26 // for `use self::foo<|>`, don't suggest `foo` as a completion 24 // for `use self::foo<|>`, don't suggest `foo` as a completion
27 tested_by!(dont_complete_current_use); 25 tested_by!(dont_complete_current_use);
28 continue; 26 continue;