@@ -455,15 +455,14 @@ pub fn compiler_args(
455455 . unwrap( )
456456 . to_string( )
457457 } else {
458- format!(
459- "lib/{}" ,
460- Path :: join(
458+ Path :: new( "lib" )
459+ . join( Path :: join(
461460 Path :: new( & spec. get_out_of_source_dir( ) ) ,
462- Path :: new( file_path) . parent( ) . unwrap( )
463- )
461+ Path :: new( file_path) . parent( ) . unwrap( ) ,
462+ ) )
464463 . to_str( )
465464 . unwrap( )
466- )
465+ . to_string ( )
467466 } ,
468467 root_config. get_suffix( spec) ,
469468 ) ,
@@ -645,41 +644,46 @@ fn compile_file(
645644 // perhaps we can do this copying somewhere else
646645 if !is_interface {
647646 let _ = std:: fs:: copy (
648- std:: path:: Path :: new ( & package. get_build_path ( ) )
647+ package
648+ . get_build_path ( )
649649 . join ( dir)
650650 // because editor tooling doesn't support namespace entries yet
651651 // we just remove the @ for now. This makes sure the editor support
652652 // doesn't break
653- . join ( module_name . to_string ( ) + " .cmi") ,
654- ocaml_build_path_abs. join ( module_name . to_string ( ) + " .cmi") ,
653+ . join ( format ! ( "{} .cmi", module_name ) ) ,
654+ ocaml_build_path_abs. join ( format ! ( "{} .cmi", module_name ) ) ,
655655 ) ;
656656 let _ = std:: fs:: copy (
657- std:: path:: Path :: new ( & package. get_build_path ( ) )
657+ package
658+ . get_build_path ( )
658659 . join ( dir)
659- . join ( module_name . to_string ( ) + " .cmj") ,
660- ocaml_build_path_abs. join ( module_name . to_string ( ) + " .cmj") ,
660+ . join ( format ! ( "{} .cmj", module_name ) ) ,
661+ ocaml_build_path_abs. join ( format ! ( "{} .cmj", module_name ) ) ,
661662 ) ;
662663 let _ = std:: fs:: copy (
663- std:: path:: Path :: new ( & package. get_build_path ( ) )
664+ package
665+ . get_build_path ( )
664666 . join ( dir)
665667 // because editor tooling doesn't support namespace entries yet
666668 // we just remove the @ for now. This makes sure the editor support
667669 // doesn't break
668- . join ( module_name . to_string ( ) + " .cmt") ,
669- ocaml_build_path_abs. join ( module_name . to_string ( ) + " .cmt") ,
670+ . join ( format ! ( "{} .cmt", module_name ) ) ,
671+ ocaml_build_path_abs. join ( format ! ( "{} .cmt", module_name ) ) ,
670672 ) ;
671673 } else {
672674 let _ = std:: fs:: copy (
673- std:: path:: Path :: new ( & package. get_build_path ( ) )
675+ package
676+ . get_build_path ( )
674677 . join ( dir)
675- . join ( module_name . to_string ( ) + " .cmti") ,
676- ocaml_build_path_abs. join ( module_name . to_string ( ) + " .cmti") ,
678+ . join ( format ! ( "{} .cmti", module_name ) ) ,
679+ ocaml_build_path_abs. join ( format ! ( "{} .cmti", module_name ) ) ,
677680 ) ;
678681 let _ = std:: fs:: copy (
679- std:: path:: Path :: new ( & package. get_build_path ( ) )
682+ package
683+ . get_build_path ( )
680684 . join ( dir)
681- . join ( module_name . to_string ( ) + " .cmi") ,
682- ocaml_build_path_abs. join ( module_name . to_string ( ) + " .cmi") ,
685+ . join ( format ! ( "{} .cmi", module_name ) ) ,
686+ ocaml_build_path_abs. join ( format ! ( "{} .cmi", module_name ) ) ,
683687 ) ;
684688 }
685689
@@ -692,14 +696,15 @@ fn compile_file(
692696 // editor tools expects the source file in lib/bs for finding the current package
693697 // and in lib/ocaml when referencing modules in other packages
694698 let _ = std:: fs:: copy (
695- std :: path :: Path :: new ( & package. path ) . join ( path) ,
696- std :: path :: Path :: new ( & package. get_build_path ( ) ) . join ( path) ,
699+ Path :: new ( & package. path ) . join ( path) ,
700+ package. get_build_path ( ) . join ( path) ,
697701 )
698702 . expect ( "copying source file failed" ) ;
699703
700704 let _ = std:: fs:: copy (
701- std:: path:: Path :: new ( & package. path ) . join ( path) ,
702- std:: path:: Path :: new ( & package. get_ocaml_build_path ( ) )
705+ Path :: new ( & package. path ) . join ( path) ,
706+ package
707+ . get_ocaml_build_path ( )
703708 . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) ,
704709 )
705710 . expect ( "copying source file failed" ) ;
@@ -715,14 +720,15 @@ fn compile_file(
715720 // editor tools expects the source file in lib/bs for finding the current package
716721 // and in lib/ocaml when referencing modules in other packages
717722 let _ = std:: fs:: copy (
718- std :: path :: Path :: new ( & package. path ) . join ( path) ,
719- std :: path :: Path :: new ( & package. get_build_path ( ) ) . join ( path) ,
723+ Path :: new ( & package. path ) . join ( path) ,
724+ package. get_build_path ( ) . join ( path) ,
720725 )
721726 . expect ( "copying source file failed" ) ;
722727
723728 let _ = std:: fs:: copy (
724- std:: path:: Path :: new ( & package. path ) . join ( path) ,
725- std:: path:: Path :: new ( & package. get_ocaml_build_path ( ) )
729+ Path :: new ( & package. path ) . join ( path) ,
730+ package
731+ . get_ocaml_build_path ( )
726732 . join ( std:: path:: Path :: new ( path) . file_name ( ) . unwrap ( ) ) ,
727733 )
728734 . expect ( "copying source file failed" ) ;
@@ -739,11 +745,11 @@ fn compile_file(
739745 ..
740746 } ) => {
741747 let source = helpers:: get_source_file_from_rescript_file (
742- & std :: path :: Path :: new ( & package. path ) . join ( path) ,
748+ & Path :: new ( & package. path ) . join ( path) ,
743749 & root_package. config . get_suffix ( spec) ,
744750 ) ;
745751 let destination = helpers:: get_source_file_from_rescript_file (
746- & std :: path :: Path :: new ( & package. get_build_path ( ) ) . join ( path) ,
752+ & package. get_build_path ( ) . join ( path) ,
747753 & root_package. config . get_suffix ( spec) ,
748754 ) ;
749755
0 commit comments