mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +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
@ -789,11 +789,7 @@ impl Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// whether this function is associated with some trait/impl
|
/// whether this function is associated with some trait/impl
|
||||||
pub fn is_associated(self, db: &dyn HirDatabase) -> bool {
|
pub fn is_assoc_item(self, db: &dyn HirDatabase) -> bool {
|
||||||
if self.self_param(db).is_some() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let fn_parent_kind = self
|
let fn_parent_kind = self
|
||||||
.source(db)
|
.source(db)
|
||||||
.value
|
.value
|
||||||
|
@ -746,7 +746,7 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
|
|||||||
if func.is_unsafe(db) {
|
if func.is_unsafe(db) {
|
||||||
h |= HighlightModifier::Unsafe;
|
h |= HighlightModifier::Unsafe;
|
||||||
}
|
}
|
||||||
if func.is_associated(db) {
|
if func.is_assoc_item(db) && func.self_param(db).is_none() {
|
||||||
h |= HighlightModifier::Static;
|
h |= HighlightModifier::Static;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
Loading…
Reference in New Issue
Block a user