From 7960c8b27681ebeb72d83930c4a2bbf43a982c52 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 5 Dec 2018 12:17:38 +0300 Subject: restore index-based gotodef --- crates/ra_analysis/src/imp.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index fe1dfefea..ab6d111c2 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -214,7 +214,7 @@ impl AnalysisImpl { { let scope = fn_descr.scope(&*self.db); // First try to resolve the symbol locally - return if let Some(entry) = scope.resolve_local_name(name_ref) { + if let Some(entry) = scope.resolve_local_name(name_ref) { let mut vec = vec![]; vec.push(( position.file_id, @@ -224,12 +224,11 @@ impl AnalysisImpl { kind: NAME, }, )); - Ok(vec) - } else { - // If that fails try the index based approach. - self.index_resolve(name_ref) + return Ok(vec); }; } + // If that fails try the index based approach. + return self.index_resolve(name_ref); } if let Some(name) = find_node_at_offset::(syntax, position.offset) { if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { -- cgit v1.2.3