@@ -640,33 +640,41 @@ impl<'a> Translator<'a> {
640640 pub ( crate ) fn should_be_excluded ( & self , item : & impl ast:: AstNode ) -> bool {
641641 if self . source_kind == SourceKind :: Library {
642642 let syntax = item. syntax ( ) ;
643- if let Some ( body) = syntax. parent ( ) . and_then ( Fn :: cast) . and_then ( |x| x. body ( ) ) {
644- if body. syntax ( ) == syntax {
645- tracing:: debug!( "Skipping Fn body" ) ;
646- return true ;
647- }
643+ if syntax
644+ . parent ( )
645+ . and_then ( Fn :: cast)
646+ . and_then ( |x| x. body ( ) )
647+ . is_some_and ( |body| body. syntax ( ) == syntax)
648+ {
649+ tracing:: debug!( "Skipping Fn body" ) ;
650+ return true ;
648651 }
649- if let Some ( body) = syntax. parent ( ) . and_then ( Const :: cast) . and_then ( |x| x. body ( ) ) {
650- if body. syntax ( ) == syntax {
651- tracing:: debug!( "Skipping Const body" ) ;
652- return true ;
653- }
652+ if syntax
653+ . parent ( )
654+ . and_then ( Const :: cast)
655+ . and_then ( |x| x. body ( ) )
656+ . is_some_and ( |body| body. syntax ( ) == syntax)
657+ {
658+ tracing:: debug!( "Skipping Const body" ) ;
659+ return true ;
654660 }
655- if let Some ( body ) = syntax
661+ if syntax
656662 . parent ( )
657663 . and_then ( Static :: cast)
658664 . and_then ( |x| x. body ( ) )
665+ . is_some_and ( |body| body. syntax ( ) == syntax)
659666 {
660- if body. syntax ( ) == syntax {
661- tracing:: debug!( "Skipping Static body" ) ;
662- return true ;
663- }
667+ tracing:: debug!( "Skipping Static body" ) ;
668+ return true ;
664669 }
665- if let Some ( pat) = syntax. parent ( ) . and_then ( Param :: cast) . and_then ( |x| x. pat ( ) ) {
666- if pat. syntax ( ) == syntax {
667- tracing:: debug!( "Skipping parameter" ) ;
668- return true ;
669- }
670+ if syntax
671+ . parent ( )
672+ . and_then ( Param :: cast)
673+ . and_then ( |x| x. pat ( ) )
674+ . is_some_and ( |pat| pat. syntax ( ) == syntax)
675+ {
676+ tracing:: debug!( "Skipping parameter" ) ;
677+ return true ;
670678 }
671679 }
672680 false
0 commit comments