mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Introduce hir::Type
It should provide a convenient API over more low-level Ty
This commit is contained in:
parent
5901cc7360
commit
e5eadb3390
15 changed files with 253 additions and 136 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use hir::{Mutability, Name, Source};
|
||||
use hir::{Name, Source};
|
||||
use ra_db::SourceDatabase;
|
||||
use ra_prof::profile;
|
||||
use ra_syntax::{ast, AstNode, Direction, SyntaxElement, SyntaxKind, SyntaxKind::*, TextRange, T};
|
||||
|
@ -230,11 +230,10 @@ fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str {
|
|||
Local(local) => {
|
||||
if local.is_mut(db) {
|
||||
"variable.mut"
|
||||
} else if local.ty(db).is_mutable_reference() {
|
||||
"variable.mut"
|
||||
} else {
|
||||
match local.ty(db).as_reference() {
|
||||
Some((_, Mutability::Mut)) => "variable.mut",
|
||||
_ => "variable",
|
||||
}
|
||||
"variable"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue