mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs address comments
This commit is contained in:
parent
3aa0e40726
commit
90031a267a
2 changed files with 2 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue