From f9d9e0a1f75b48813fe816a1e2a6c30146a36503 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 15:53:16 +0300 Subject: several highlighting cleanups * make stuff more type-safe by using `BindPat` instead of just `Pat` * don't add `mut` into binding hash * reset shadow counter when we enter a function --- crates/ra_ide_api/src/display/navigation_target.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'crates/ra_ide_api/src/display/navigation_target.rs') diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 8cc853dd1..8aff5f2cd 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs @@ -91,24 +91,11 @@ impl NavigationTarget { pub(crate) fn from_pat( db: &RootDatabase, file_id: FileId, - pat: AstPtr, + pat: AstPtr, ) -> NavigationTarget { let parse = db.parse(file_id); - let (name, full_range) = match pat.to_node(parse.tree().syntax()).kind() { - ast::PatKind::BindPat(pat) => return NavigationTarget::from_bind_pat(file_id, &pat), - _ => ("_".into(), pat.syntax_node_ptr().range()), - }; - - NavigationTarget { - file_id, - name, - full_range, - focus_range: None, - kind: NAME, - container_name: None, - description: None, //< No documentation for Description - docs: None, //< No documentation for Pattern - } + let pat = pat.to_node(parse.tree().syntax()); + NavigationTarget::from_bind_pat(file_id, &pat) } pub(crate) fn from_self_param( -- cgit v1.2.3