@@ -640,33 +640,41 @@ impl<'a> Translator<'a> {
640
640
pub ( crate ) fn should_be_excluded ( & self , item : & impl ast:: AstNode ) -> bool {
641
641
if self . source_kind == SourceKind :: Library {
642
642
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 ;
648
651
}
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 ;
654
660
}
655
- if let Some ( body ) = syntax
661
+ if syntax
656
662
. parent ( )
657
663
. and_then ( Static :: cast)
658
664
. and_then ( |x| x. body ( ) )
665
+ . is_some_and ( |body| body. syntax ( ) == syntax)
659
666
{
660
- if body. syntax ( ) == syntax {
661
- tracing:: debug!( "Skipping Static body" ) ;
662
- return true ;
663
- }
667
+ tracing:: debug!( "Skipping Static body" ) ;
668
+ return true ;
664
669
}
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 ;
670
678
}
671
679
}
672
680
false
0 commit comments