@@ -696,16 +696,15 @@ impl PythonBindGenerator {
696696 let snake_case_name = & variable_info[ 2 ] ;
697697
698698 self . file_contents . push ( Cow :: Borrowed ( "" ) ) ;
699+ self . file_contents
700+ . push ( Cow :: Owned ( format ! ( " if {snake_case_name}.is_some() {{" , ) ) ) ;
699701 self . file_contents . push ( Cow :: Owned ( format ! (
700- " if {snake_case_name}.is_some() {{" ,
701- ) ) ) ;
702- self . file_contents . push ( Cow :: Owned ( format ! (
703- " item_type = {}Type::{variable_name};" , self . struct_name
702+ " item_type = {}Type::{variable_name};" ,
703+ self . struct_name
704704 ) ) ) ;
705705 self . file_contents . push ( Cow :: Borrowed ( " }" ) ) ;
706706 }
707707
708-
709708 self . write_str ( "" ) ;
710709 self . write_str ( " Self {" ) ;
711710 self . write_str ( " item_type," ) ;
@@ -1040,15 +1039,14 @@ fn mod_rs_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Res
10401039}
10411040
10421041fn class_names_txt_generator ( type_data : & [ ( String , String , Vec < Vec < String > > ) ] ) -> io:: Result < ( ) > {
1043- let mut file_contents = vec ! [ "[" . to_string( ) ] ;
1044-
1045- for ( _, type_name, _) in type_data {
1046- file_contents. push ( format ! ( " {type_name}," ) ) ;
1047- }
1042+ let class_names = type_data
1043+ . iter ( )
1044+ . map ( |( _, type_name, _) | format ! ( " {type_name}" ) )
1045+ . collect :: < Vec < _ > > ( ) ;
10481046
1049- file_contents. push ( "]" . to_string ( ) ) ;
1047+ let file_contents = format ! ( "[ \n {} \n ]" , class_names . join ( ", \n " ) ) ;
10501048
1051- fs:: write ( "classes.txt" , file_contents. join ( " \n " ) ) ?;
1049+ fs:: write ( "classes.txt" , file_contents) ?;
10521050
10531051 Ok ( ( ) )
10541052}
0 commit comments