Skip to content

Commit 90031a2

Browse files
author
Anatol Liu
committed
Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs address comments
1 parent 3aa0e40 commit 90031a2

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

crates/hir/src/code_model.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,7 @@ impl Function {
789789
}
790790

791791
/// whether this function is associated with some trait/impl
792-
pub fn is_associated(self, db: &dyn HirDatabase) -> bool {
793-
if self.self_param(db).is_some() {
794-
return false;
795-
}
796-
792+
pub fn is_assoc_item(self, db: &dyn HirDatabase) -> bool {
797793
let fn_parent_kind = self
798794
.source(db)
799795
.value

crates/ide/src/syntax_highlighting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
746746
if func.is_unsafe(db) {
747747
h |= HighlightModifier::Unsafe;
748748
}
749-
if func.is_associated(db) {
749+
if func.is_assoc_item(db) && func.self_param(db).is_none() {
750750
h |= HighlightModifier::Static;
751751
}
752752
return h;

0 commit comments

Comments
 (0)