@@ -560,12 +560,10 @@ fn impl_pg_node(items: &[syn::Item]) -> eyre::Result<proc_macro2::TokenStream> {
560560 } ;
561561
562562 // grab the type name of the first field
563- let ty_name = if let syn:: Type :: Path ( p) = & first_field. ty {
564- if let Some ( last_segment) = p. path . segments . last ( ) {
565- last_segment. ident . to_string ( )
566- } else {
567- continue ;
568- }
563+ let ty_name = if let syn:: Type :: Path ( p) = & first_field. ty
564+ && let Some ( last_segment) = p. path . segments . last ( )
565+ {
566+ last_segment. ident . to_string ( )
569567 } else {
570568 continue ;
571569 } ;
@@ -689,19 +687,18 @@ impl<'a> From<&'a [syn::Item]> for StructGraph<'a> {
689687 _ => continue ,
690688 } ;
691689
692- if let syn:: Type :: Path ( p) = & first_field. ty {
693- // We should be guaranteed that just extracting the last path
694- // segment is ok because these structs are all from the same module.
695- // (also, they are all generated from C code, so collisions should be
696- // impossible anyway thanks to C's single shared namespace).
697- if let Some ( last_segment) = p. path . segments . last ( ) {
698- if let Some ( parent_offset) = name_tab. get ( & last_segment. ident . to_string ( ) ) {
699- // establish the 2-way link
700- let child_offset = name_tab[ & id] ;
701- descriptors[ child_offset] . parent = Some ( * parent_offset) ;
702- descriptors[ * parent_offset] . children . push ( child_offset) ;
703- }
704- }
690+ // We should be guaranteed that just extracting the last path
691+ // segment is ok because these structs are all from the same module.
692+ // (also, they are all generated from C code, so collisions should be
693+ // impossible anyway thanks to C's single shared namespace).
694+ if let syn:: Type :: Path ( p) = & first_field. ty
695+ && let Some ( last_segment) = p. path . segments . last ( )
696+ && let Some ( parent_offset) = name_tab. get ( & last_segment. ident . to_string ( ) )
697+ {
698+ // establish the 2-way link
699+ let child_offset = name_tab[ & id] ;
700+ descriptors[ child_offset] . parent = Some ( * parent_offset) ;
701+ descriptors[ * parent_offset] . children . push ( child_offset) ;
705702 }
706703 }
707704
@@ -1165,10 +1162,10 @@ fn rewrite_c_abi_to_c_unwind(file: &mut syn::File) {
11651162 pub struct Visitor { }
11661163 impl VisitMut for Visitor {
11671164 fn visit_abi_mut ( & mut self , abi : & mut syn:: Abi ) {
1168- if let Some ( name) = & mut abi. name {
1169- if name. value ( ) == "C" {
1170- * name = LitStr :: new ( "C-unwind" , Span :: call_site ( ) ) ;
1171- }
1165+ if let Some ( name) = & mut abi. name
1166+ && name. value ( ) == "C"
1167+ {
1168+ * name = LitStr :: new ( "C-unwind" , Span :: call_site ( ) ) ;
11721169 }
11731170 }
11741171 }
0 commit comments