@@ -18,7 +18,7 @@ use ra_ap_ide_db::line_index::{LineCol, LineIndex};
1818use ra_ap_ide_db:: RootDatabase ;
1919use ra_ap_parser:: SyntaxKind ;
2020use ra_ap_span:: { EditionedFileId , TextSize } ;
21- use ra_ap_syntax:: ast:: HasName ;
21+ use ra_ap_syntax:: ast:: { Const , Fn , HasName , Static } ;
2222use ra_ap_syntax:: {
2323 ast, AstNode , NodeOrToken , SyntaxElementChildren , SyntaxError , SyntaxNode , SyntaxToken ,
2424 TextRange ,
@@ -563,7 +563,31 @@ impl<'a> Translator<'a> {
563563 } ) ( ) ;
564564 }
565565
566- pub ( crate ) fn should_be_excluded ( & self , item : & impl ast:: HasAttrs ) -> bool {
566+ pub ( crate ) fn should_be_excluded ( & self , item : & ( impl ast:: HasAttrs + ast:: AstNode ) ) -> bool {
567+ let syntax = item. syntax ( ) ;
568+ if let Some ( body) = syntax. parent ( ) . and_then ( Fn :: cast) . and_then ( |x| x. body ( ) ) {
569+ if body. syntax ( ) == item. syntax ( ) {
570+ log:: warn!( "Skipping Fn body" ) ;
571+ return true ;
572+ }
573+ }
574+ if let Some ( body) = syntax. parent ( ) . and_then ( Const :: cast) . and_then ( |x| x. body ( ) ) {
575+ if body. syntax ( ) == item. syntax ( ) {
576+ log:: warn!( "Skipping Const body" ) ;
577+ return true ;
578+ }
579+ }
580+ if let Some ( body) = syntax
581+ . parent ( )
582+ . and_then ( Static :: cast)
583+ . and_then ( |x| x. body ( ) )
584+ {
585+ if body. syntax ( ) == item. syntax ( ) {
586+ log:: warn!( "Skipping Static body" ) ;
587+ return true ;
588+ }
589+ }
590+
567591 self . semantics . is_some_and ( |sema| {
568592 item. attrs ( ) . any ( |attr| {
569593 attr. as_simple_call ( ) . is_some_and ( |( name, tokens) | {
0 commit comments