@@ -417,8 +417,8 @@ pub fn compiler_args(
417417
418418        specs
419419            . iter ( ) 
420-             . map ( |spec| { 
421-                 return   vec ! [ 
420+             . flat_map ( |spec| { 
421+                 vec ! [ 
422422                    "-bs-package-output" . to_string( ) , 
423423                    format!( 
424424                        "{}:{}:{}" , 
@@ -437,9 +437,8 @@ pub fn compiler_args(
437437                        } , 
438438                        root_config. get_suffix( spec) , 
439439                    ) , 
440-                 ] ; 
440+                 ] 
441441            } ) 
442-             . flatten ( ) 
443442            . collect ( ) 
444443    } ; 
445444
@@ -614,8 +613,7 @@ fn compile_file(
614613            Err ( stderr. to_string ( )  + & stdout) 
615614        } 
616615        Err ( e)  => Err ( format ! ( 
617-             "Could not compile file. Error: {}. Path to AST: {:?}" , 
618-             e,  ast_path
616+             "Could not compile file. Error: {e}. Path to AST: {ast_path:?}" 
619617        ) ) , 
620618        Ok ( x)  => { 
621619            let  err = std:: str:: from_utf8 ( & x. stderr ) 
@@ -633,15 +631,15 @@ fn compile_file(
633631                        // because editor tooling doesn't support namespace entries yet 
634632                        // we just remove the @ for now. This makes sure the editor support 
635633                        // doesn't break 
636-                         . join ( format ! ( "{}.cmi" ,  module_name ) ) , 
637-                     ocaml_build_path_abs. join ( format ! ( "{}.cmi" ,  module_name ) ) , 
634+                         . join ( format ! ( "{module_name }.cmi" ) ) , 
635+                     ocaml_build_path_abs. join ( format ! ( "{module_name }.cmi" ) ) , 
638636                ) ; 
639637                let  _ = std:: fs:: copy ( 
640638                    package
641639                        . get_build_path ( ) 
642640                        . join ( dir) 
643-                         . join ( format ! ( "{}.cmj" ,  module_name ) ) , 
644-                     ocaml_build_path_abs. join ( format ! ( "{}.cmj" ,  module_name ) ) , 
641+                         . join ( format ! ( "{module_name }.cmj" ) ) , 
642+                     ocaml_build_path_abs. join ( format ! ( "{module_name }.cmj" ) ) , 
645643                ) ; 
646644                let  _ = std:: fs:: copy ( 
647645                    package
@@ -650,98 +648,89 @@ fn compile_file(
650648                        // because editor tooling doesn't support namespace entries yet 
651649                        // we just remove the @ for now. This makes sure the editor support 
652650                        // doesn't break 
653-                         . join ( format ! ( "{}.cmt" ,  module_name ) ) , 
654-                     ocaml_build_path_abs. join ( format ! ( "{}.cmt" ,  module_name ) ) , 
651+                         . join ( format ! ( "{module_name }.cmt" ) ) , 
652+                     ocaml_build_path_abs. join ( format ! ( "{module_name }.cmt" ) ) , 
655653                ) ; 
656654            }  else  { 
657655                let  _ = std:: fs:: copy ( 
658656                    package
659657                        . get_build_path ( ) 
660658                        . join ( dir) 
661-                         . join ( format ! ( "{}.cmti" ,  module_name ) ) , 
662-                     ocaml_build_path_abs. join ( format ! ( "{}.cmti" ,  module_name ) ) , 
659+                         . join ( format ! ( "{module_name }.cmti" ) ) , 
660+                     ocaml_build_path_abs. join ( format ! ( "{module_name }.cmti" ) ) , 
663661                ) ; 
664662                let  _ = std:: fs:: copy ( 
665663                    package
666664                        . get_build_path ( ) 
667665                        . join ( dir) 
668-                         . join ( format ! ( "{}.cmi" ,  module_name ) ) , 
669-                     ocaml_build_path_abs. join ( format ! ( "{}.cmi" ,  module_name ) ) , 
666+                         . join ( format ! ( "{module_name }.cmi" ) ) , 
667+                     ocaml_build_path_abs. join ( format ! ( "{module_name }.cmi" ) ) , 
670668                ) ; 
671669            } 
672670
673-             match  & module. source_type  { 
674-                 SourceType :: SourceFile ( SourceFile  { 
671+             if  let  SourceType :: SourceFile ( SourceFile  { 
675672                    interface :  Some ( Interface  {  path,  .. } ) , 
676673                    ..
677-                 } )  => { 
678-                     // we need to copy the source file to the build directory. 
679-                     // editor tools expects the source file in lib/bs for finding the current package 
680-                     // and in lib/ocaml when referencing modules in other packages 
681-                     let  _ = std:: fs:: copy ( 
682-                         Path :: new ( & package. path ) . join ( path) , 
683-                         package. get_build_path ( ) . join ( path) , 
684-                     ) 
685-                     . expect ( "copying source file failed" ) ; 
686- 
687-                     let  _ = std:: fs:: copy ( 
688-                         Path :: new ( & package. path ) . join ( path) , 
689-                         package
690-                             . get_ocaml_build_path ( ) 
691-                             . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) , 
692-                     ) 
693-                     . expect ( "copying source file failed" ) ; 
694-                 } 
695-                 _ => ( ) , 
674+                 } )  = & module. source_type  { 
675+                 // we need to copy the source file to the build directory. 
676+                 // editor tools expects the source file in lib/bs for finding the current package 
677+                 // and in lib/ocaml when referencing modules in other packages 
678+                 let  _ = std:: fs:: copy ( 
679+                     Path :: new ( & package. path ) . join ( path) , 
680+                     package. get_build_path ( ) . join ( path) , 
681+                 ) 
682+                 . expect ( "copying source file failed" ) ; 
683+ 
684+                 let  _ = std:: fs:: copy ( 
685+                     Path :: new ( & package. path ) . join ( path) , 
686+                     package
687+                         . get_ocaml_build_path ( ) 
688+                         . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) , 
689+                 ) 
690+                 . expect ( "copying source file failed" ) ; 
696691            } 
697-             match  & module. source_type  { 
698-                 SourceType :: SourceFile ( SourceFile  { 
692+             if  let  SourceType :: SourceFile ( SourceFile  { 
699693                    implementation :  Implementation  {  path,  .. } , 
700694                    ..
701-                 } )  => { 
702-                     // we need to copy the source file to the build directory. 
703-                     // editor tools expects the source file in lib/bs for finding the current package 
704-                     // and in lib/ocaml when referencing modules in other packages 
705-                     let  _ = std:: fs:: copy ( 
706-                         Path :: new ( & package. path ) . join ( path) , 
707-                         package. get_build_path ( ) . join ( path) , 
708-                     ) 
709-                     . expect ( "copying source file failed" ) ; 
710- 
711-                     let  _ = std:: fs:: copy ( 
712-                         Path :: new ( & package. path ) . join ( path) , 
713-                         package
714-                             . get_ocaml_build_path ( ) 
715-                             . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) , 
716-                     ) 
717-                     . expect ( "copying source file failed" ) ; 
718-                 } 
719-                 _ => ( ) , 
695+                 } )  = & module. source_type  { 
696+                 // we need to copy the source file to the build directory. 
697+                 // editor tools expects the source file in lib/bs for finding the current package 
698+                 // and in lib/ocaml when referencing modules in other packages 
699+                 let  _ = std:: fs:: copy ( 
700+                     Path :: new ( & package. path ) . join ( path) , 
701+                     package. get_build_path ( ) . join ( path) , 
702+                 ) 
703+                 . expect ( "copying source file failed" ) ; 
704+ 
705+                 let  _ = std:: fs:: copy ( 
706+                     Path :: new ( & package. path ) . join ( path) , 
707+                     package
708+                         . get_ocaml_build_path ( ) 
709+                         . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) , 
710+                 ) 
711+                 . expect ( "copying source file failed" ) ; 
720712            } 
721713
722714            // copy js file 
723715            root_package. config . get_package_specs ( ) . iter ( ) . for_each ( |spec| { 
724716                if  spec. in_source  { 
725-                     match  & module. source_type  { 
726-                         SourceType :: SourceFile ( SourceFile  { 
717+                     if  let  SourceType :: SourceFile ( SourceFile  { 
727718                            implementation :  Implementation  {  path,  .. } , 
728719                            ..
729-                         } )  => { 
730-                             let  source = helpers:: get_source_file_from_rescript_file ( 
731-                                 & Path :: new ( & package. path ) . join ( path) , 
732-                                 & root_package. config . get_suffix ( spec) , 
733-                             ) ; 
734-                             let  destination = helpers:: get_source_file_from_rescript_file ( 
735-                                 & package. get_build_path ( ) . join ( path) , 
736-                                 & root_package. config . get_suffix ( spec) , 
737-                             ) ; 
738- 
739-                             if  source. exists ( )  { 
740-                                 let  _ =
741-                                     std:: fs:: copy ( & source,  & destination) . expect ( "copying source file failed" ) ; 
742-                             } 
720+                         } )  = & module. source_type  { 
721+                         let  source = helpers:: get_source_file_from_rescript_file ( 
722+                             & Path :: new ( & package. path ) . join ( path) , 
723+                             & root_package. config . get_suffix ( spec) , 
724+                         ) ; 
725+                         let  destination = helpers:: get_source_file_from_rescript_file ( 
726+                             & package. get_build_path ( ) . join ( path) , 
727+                             & root_package. config . get_suffix ( spec) , 
728+                         ) ; 
729+ 
730+                         if  source. exists ( )  { 
731+                             let  _ =
732+                                 std:: fs:: copy ( & source,  & destination) . expect ( "copying source file failed" ) ; 
743733                        } 
744-                         _ => ( ) , 
745734                    } 
746735                } 
747736            } ) ; 
0 commit comments