@@ -484,9 +484,9 @@ fn highlight_element(
484
484
match name_kind {
485
485
Some ( NameClass :: ExternCrate ( _) ) => HighlightTag :: Module . into ( ) ,
486
486
Some ( NameClass :: Definition ( def) ) => {
487
- highlight_def ( sema , db, def, None ) | HighlightModifier :: Definition
487
+ highlight_def ( db, def) | HighlightModifier :: Definition
488
488
}
489
- Some ( NameClass :: ConstReference ( def) ) => highlight_def ( sema , db, def, None ) ,
489
+ Some ( NameClass :: ConstReference ( def) ) => highlight_def ( db, def) ,
490
490
Some ( NameClass :: FieldShorthand { field, .. } ) => {
491
491
let mut h = HighlightTag :: Field . into ( ) ;
492
492
if let Definition :: Field ( field) = field {
@@ -520,7 +520,7 @@ fn highlight_element(
520
520
}
521
521
} ;
522
522
523
- let mut h = highlight_def ( sema , db, def, Some ( name_ref . clone ( ) ) ) ;
523
+ let mut h = highlight_def ( db, def) ;
524
524
525
525
if let Some ( parent) = name_ref. syntax ( ) . parent ( ) {
526
526
if matches ! ( parent. kind( ) , FIELD_EXPR | RECORD_PAT_FIELD ) {
@@ -736,34 +736,24 @@ fn highlight_method_call(
736
736
Some ( h)
737
737
}
738
738
739
- fn highlight_def (
740
- sema : & Semantics < RootDatabase > ,
741
- db : & RootDatabase ,
742
- def : Definition ,
743
- name_ref : Option < ast:: NameRef > ,
744
- ) -> Highlight {
739
+ fn highlight_def ( db : & RootDatabase , def : Definition ) -> Highlight {
745
740
match def {
746
741
Definition :: Macro ( _) => HighlightTag :: Macro ,
747
742
Definition :: Field ( _) => HighlightTag :: Field ,
748
743
Definition :: ModuleDef ( def) => match def {
749
744
hir:: ModuleDef :: Module ( _) => HighlightTag :: Module ,
750
745
hir:: ModuleDef :: Function ( func) => {
751
- return name_ref
752
- . and_then ( |name_ref| highlight_func_by_name_ref ( sema, & name_ref) )
753
- . unwrap_or_else ( || {
754
- let mut h = HighlightTag :: Function . into ( ) ;
755
- if func. is_unsafe ( db) {
756
- h |= HighlightModifier :: Unsafe ;
757
- }
758
-
759
- match func. self_param ( db) {
760
- None => h,
761
- Some ( self_param) => match self_param. access ( db) {
762
- hir:: Access :: Exclusive => h | HighlightModifier :: Mutable ,
763
- hir:: Access :: Shared | hir:: Access :: Owned => h,
764
- } ,
765
- }
766
- } ) ;
746
+ let mut h = HighlightTag :: Function . into ( ) ;
747
+ if func. is_unsafe ( db) {
748
+ h |= HighlightModifier :: Unsafe ;
749
+ }
750
+ if let Some ( self_param) = func. self_param ( db) {
751
+ match self_param. access ( db) {
752
+ hir:: Access :: Exclusive => h |= HighlightModifier :: Mutable ,
753
+ hir:: Access :: Shared | hir:: Access :: Owned => ( ) ,
754
+ }
755
+ }
756
+ return h;
767
757
}
768
758
hir:: ModuleDef :: Adt ( hir:: Adt :: Struct ( _) ) => HighlightTag :: Struct ,
769
759
hir:: ModuleDef :: Adt ( hir:: Adt :: Enum ( _) ) => HighlightTag :: Enum ,
0 commit comments