aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-18 18:11:05 +0100
committerAleksey Kladov <[email protected]>2019-07-18 18:16:33 +0100
commit1edec77e582b83ba97c3167c7932e8fa43e2cff0 (patch)
treebd5fc107bbd6ef5c00122fbe275d5cc830fa303f /crates/ra_ide_api/src/syntax_highlighting.rs
parent8a6d270ecc26b59ad7ab0a207a963dc14f7bf81b (diff)
cleanup imports
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index d84ae2cb2..020c73c32 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -4,8 +4,7 @@ use hir::{Mutability, Ty};
4use ra_db::SourceDatabase; 4use ra_db::SourceDatabase;
5use ra_prof::profile; 5use ra_prof::profile;
6use ra_syntax::{ 6use ra_syntax::{
7 ast, AstNode, Direction, Pat, PatKind, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, 7 ast, AstNode, Direction, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, TextRange, T,
8 TextRange, T,
9}; 8};
10 9
11use crate::{db::RootDatabase, FileId}; 10use crate::{db::RootDatabase, FileId};
@@ -32,7 +31,7 @@ fn is_control_keyword(kind: SyntaxKind) -> bool {
32 } 31 }
33} 32}
34 33
35fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &Pat) -> bool { 34fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &ast::Pat) -> bool {
36 let ty = analyzer.type_of_pat(db, pat).unwrap_or(Ty::Unknown); 35 let ty = analyzer.type_of_pat(db, pat).unwrap_or(Ty::Unknown);
37 let is_ty_mut = { 36 let is_ty_mut = {
38 if let Some((_, mutability)) = ty.as_reference() { 37 if let Some((_, mutability)) = ty.as_reference() {
@@ -46,7 +45,7 @@ fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &
46 }; 45 };
47 46
48 let is_pat_mut = match pat.kind() { 47 let is_pat_mut = match pat.kind() {
49 PatKind::BindPat(bind_pat) => bind_pat.is_mutable(), 48 ast::PatKind::BindPat(bind_pat) => bind_pat.is_mutable(),
50 _ => false, 49 _ => false,
51 }; 50 };
52 51
@@ -137,7 +136,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
137 NAME => { 136 NAME => {
138 if let Some(name) = node.as_node().and_then(ast::Name::cast) { 137 if let Some(name) = node.as_node().and_then(ast::Name::cast) {
139 let analyzer = hir::SourceAnalyzer::new(db, file_id, name.syntax(), None); 138 let analyzer = hir::SourceAnalyzer::new(db, file_id, name.syntax(), None);
140 if let Some(pat) = name.syntax().ancestors().find_map(Pat::cast) { 139 if let Some(pat) = name.syntax().ancestors().find_map(ast::Pat::cast) {
141 binding_hash = Some({ 140 binding_hash = Some({
142 let text = name.syntax().text().to_smol_string(); 141 let text = name.syntax().text().to_smol_string();
143 let shadow_count = 142 let shadow_count =