Add static semantic token modifier for associated functions with no &self

refactor logic into code_model.rs

address comments
This commit is contained in:
Anatol Liu 2020-11-04 20:08:46 -08:00
parent 3aa0e40726
commit 90031a267a
2 changed files with 2 additions and 6 deletions

View file

@ -789,11 +789,7 @@ impl Function {
}
/// whether this function is associated with some trait/impl
pub fn is_associated(self, db: &dyn HirDatabase) -> bool {
if self.self_param(db).is_some() {
return false;
}
pub fn is_assoc_item(self, db: &dyn HirDatabase) -> bool {
let fn_parent_kind = self
.source(db)
.value

View file

@ -746,7 +746,7 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
if func.is_unsafe(db) {
h |= HighlightModifier::Unsafe;
}
if func.is_associated(db) {
if func.is_assoc_item(db) && func.self_param(db).is_none() {
h |= HighlightModifier::Static;
}
return h;