aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-18 17:52:33 +0000
committerAleksey Kladov <[email protected]>2020-02-18 17:52:33 +0000
commit97ab471b6dadf69292d760cc5fcac695ddc5e240 (patch)
tree0e608631db939f1e174ff8f793759c0a3dcef006
parent04080dc4f6522f99356ea130fc83c55e9457e700 (diff)
Minor simplification
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 20c414ca1..1e5e0f420 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -95,7 +95,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
95 _ if in_macro_call.is_some() => { 95 _ if in_macro_call.is_some() => {
96 if let Some(token) = node.as_token() { 96 if let Some(token) = node.as_token() {
97 if let Some((tag, binding_hash)) = highlight_token_tree( 97 if let Some((tag, binding_hash)) = highlight_token_tree(
98 db,
99 &mut sb, 98 &mut sb,
100 &analyzer, 99 &analyzer,
101 &mut bindings_shadow_count, 100 &mut bindings_shadow_count,
@@ -111,7 +110,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
111 } 110 }
112 _ => { 111 _ => {
113 if let Some((tag, binding_hash)) = highlight_node( 112 if let Some((tag, binding_hash)) = highlight_node(
114 db,
115 &mut sb, 113 &mut sb,
116 &mut bindings_shadow_count, 114 &mut bindings_shadow_count,
117 InFile::new(file_id.into(), node.clone()), 115 InFile::new(file_id.into(), node.clone()),
@@ -151,7 +149,6 @@ fn highlight_macro(node: InFile<SyntaxElement>) -> Option<TextRange> {
151} 149}
152 150
153fn highlight_token_tree( 151fn highlight_token_tree(
154 db: &RootDatabase,
155 sb: &mut SourceBinder<RootDatabase>, 152 sb: &mut SourceBinder<RootDatabase>,
156 analyzer: &SourceAnalyzer, 153 analyzer: &SourceAnalyzer,
157 bindings_shadow_count: &mut FxHashMap<Name, u32>, 154 bindings_shadow_count: &mut FxHashMap<Name, u32>,
@@ -160,7 +157,7 @@ fn highlight_token_tree(
160 if token.value.parent().kind() != TOKEN_TREE { 157 if token.value.parent().kind() != TOKEN_TREE {
161 return None; 158 return None;
162 } 159 }
163 let token = descend_into_macros_with_analyzer(db, analyzer, token); 160 let token = descend_into_macros_with_analyzer(sb.db, analyzer, token);
164 let expanded = { 161 let expanded = {
165 let parent = token.value.parent(); 162 let parent = token.value.parent();
166 // We only care Name and Name_ref 163 // We only care Name and Name_ref
@@ -170,15 +167,15 @@ fn highlight_token_tree(
170 } 167 }
171 }; 168 };
172 169
173 highlight_node(db, sb, bindings_shadow_count, expanded) 170 highlight_node(sb, bindings_shadow_count, expanded)
174} 171}
175 172
176fn highlight_node( 173fn highlight_node(
177 db: &RootDatabase,
178 sb: &mut SourceBinder<RootDatabase>, 174 sb: &mut SourceBinder<RootDatabase>,
179 bindings_shadow_count: &mut FxHashMap<Name, u32>, 175 bindings_shadow_count: &mut FxHashMap<Name, u32>,
180 node: InFile<SyntaxElement>, 176 node: InFile<SyntaxElement>,
181) -> Option<(&'static str, Option<u64>)> { 177) -> Option<(&'static str, Option<u64>)> {
178 let db = sb.db;
182 let mut binding_hash = None; 179 let mut binding_hash = None;
183 let tag = match node.value.kind() { 180 let tag = match node.value.kind() {
184 FN_DEF => { 181 FN_DEF => {