mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Minor simplification
This commit is contained in:
parent
04080dc4f6
commit
97ab471b6d
1 changed files with 3 additions and 6 deletions
|
@ -95,7 +95,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
|
||||||
_ if in_macro_call.is_some() => {
|
_ if in_macro_call.is_some() => {
|
||||||
if let Some(token) = node.as_token() {
|
if let Some(token) = node.as_token() {
|
||||||
if let Some((tag, binding_hash)) = highlight_token_tree(
|
if let Some((tag, binding_hash)) = highlight_token_tree(
|
||||||
db,
|
|
||||||
&mut sb,
|
&mut sb,
|
||||||
&analyzer,
|
&analyzer,
|
||||||
&mut bindings_shadow_count,
|
&mut bindings_shadow_count,
|
||||||
|
@ -111,7 +110,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if let Some((tag, binding_hash)) = highlight_node(
|
if let Some((tag, binding_hash)) = highlight_node(
|
||||||
db,
|
|
||||||
&mut sb,
|
&mut sb,
|
||||||
&mut bindings_shadow_count,
|
&mut bindings_shadow_count,
|
||||||
InFile::new(file_id.into(), node.clone()),
|
InFile::new(file_id.into(), node.clone()),
|
||||||
|
@ -151,7 +149,6 @@ fn highlight_macro(node: InFile<SyntaxElement>) -> Option<TextRange> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_token_tree(
|
fn highlight_token_tree(
|
||||||
db: &RootDatabase,
|
|
||||||
sb: &mut SourceBinder<RootDatabase>,
|
sb: &mut SourceBinder<RootDatabase>,
|
||||||
analyzer: &SourceAnalyzer,
|
analyzer: &SourceAnalyzer,
|
||||||
bindings_shadow_count: &mut FxHashMap<Name, u32>,
|
bindings_shadow_count: &mut FxHashMap<Name, u32>,
|
||||||
|
@ -160,7 +157,7 @@ fn highlight_token_tree(
|
||||||
if token.value.parent().kind() != TOKEN_TREE {
|
if token.value.parent().kind() != TOKEN_TREE {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let token = descend_into_macros_with_analyzer(db, analyzer, token);
|
let token = descend_into_macros_with_analyzer(sb.db, analyzer, token);
|
||||||
let expanded = {
|
let expanded = {
|
||||||
let parent = token.value.parent();
|
let parent = token.value.parent();
|
||||||
// We only care Name and Name_ref
|
// We only care Name and Name_ref
|
||||||
|
@ -170,15 +167,15 @@ fn highlight_token_tree(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
highlight_node(db, sb, bindings_shadow_count, expanded)
|
highlight_node(sb, bindings_shadow_count, expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_node(
|
fn highlight_node(
|
||||||
db: &RootDatabase,
|
|
||||||
sb: &mut SourceBinder<RootDatabase>,
|
sb: &mut SourceBinder<RootDatabase>,
|
||||||
bindings_shadow_count: &mut FxHashMap<Name, u32>,
|
bindings_shadow_count: &mut FxHashMap<Name, u32>,
|
||||||
node: InFile<SyntaxElement>,
|
node: InFile<SyntaxElement>,
|
||||||
) -> Option<(&'static str, Option<u64>)> {
|
) -> Option<(&'static str, Option<u64>)> {
|
||||||
|
let db = sb.db;
|
||||||
let mut binding_hash = None;
|
let mut binding_hash = None;
|
||||||
let tag = match node.value.kind() {
|
let tag = match node.value.kind() {
|
||||||
FN_DEF => {
|
FN_DEF => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue