Give ‘unsafe’ semantic token modifier to unsafe traits

This commit is contained in:
Aramis Razzaghipour 2021-05-23 21:43:23 +10:00
parent 57eedd9066
commit 4d4dbcfead
No known key found for this signature in database
GPG key ID: F788F7E990136003
5 changed files with 20 additions and 3 deletions

View file

@ -338,7 +338,14 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
return h;
}
hir::ModuleDef::Trait(_) => HlTag::Symbol(SymbolKind::Trait),
hir::ModuleDef::Trait(trait_) => {
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Trait));
if trait_.is_unsafe(db) {
h |= HlMod::Unsafe;
}
return h;
}
hir::ModuleDef::TypeAlias(type_) => {
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::TypeAlias));
if let Some(item) = type_.as_assoc_item(db) {