@@ -441,7 +441,7 @@ impl Build {
441441 // Cargo.toml files.
442442 let rust_submodules = [ "library/backtrace" , "library/stdarch" ] ;
443443 for s in rust_submodules {
444- build. update_submodule ( Path :: new ( s ) ) ;
444+ build. update_submodule ( s ) ;
445445 }
446446 // Now, update all existing submodules.
447447 build. update_existing_submodules ( ) ;
@@ -479,7 +479,7 @@ impl Build {
479479 /// tarball). Typically [`Build::require_and_update_submodule`] should be
480480 /// used instead to provide a nice error to the user if the submodule is
481481 /// missing.
482- fn update_submodule ( & self , relative_path : & Path ) {
482+ fn update_submodule ( & self , relative_path : & str ) {
483483 if !self . config . submodules ( ) {
484484 return ;
485485 }
@@ -527,7 +527,7 @@ impl Build {
527527 return ;
528528 }
529529
530- println ! ( "Updating submodule {}" , relative_path . display ( ) ) ;
530+ println ! ( "Updating submodule {relative_path}" ) ;
531531 helpers:: git ( Some ( & self . src ) )
532532 . run_always ( )
533533 . args ( [ "submodule" , "-q" , "sync" ] )
@@ -596,9 +596,8 @@ impl Build {
596596 if cfg ! ( test) && !self . config . submodules ( ) {
597597 return ;
598598 }
599- let relative_path = Path :: new ( submodule) ;
600- self . update_submodule ( relative_path) ;
601- let absolute_path = self . config . src . join ( relative_path) ;
599+ self . update_submodule ( submodule) ;
600+ let absolute_path = self . config . src . join ( submodule) ;
602601 if dir_is_empty ( & absolute_path) {
603602 let maybe_enable = if !self . config . submodules ( )
604603 && self . config . rust_info . is_managed_git_subrepository ( )
@@ -642,22 +641,23 @@ impl Build {
642641 for line in output. lines ( ) {
643642 // Look for `submodule.$name.path = $path`
644643 // Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
645- let submodule = Path :: new ( line. split_once ( ' ' ) . unwrap ( ) . 1 ) ;
644+ let submodule = line. split_once ( ' ' ) . unwrap ( ) . 1 ;
645+ let path = Path :: new ( submodule) ;
646646 // Don't update the submodule unless it's already been cloned.
647- if GitInfo :: new ( false , submodule ) . is_managed_git_subrepository ( ) {
647+ if GitInfo :: new ( false , path ) . is_managed_git_subrepository ( ) {
648648 self . update_submodule ( submodule) ;
649649 }
650650 }
651651 }
652652
653653 /// Updates the given submodule only if it's initialized already; nothing happens otherwise.
654- pub fn update_existing_submodule ( & self , submodule : & Path ) {
654+ pub fn update_existing_submodule ( & self , submodule : & str ) {
655655 // Avoid running git when there isn't a git checkout.
656656 if !self . config . submodules ( ) {
657657 return ;
658658 }
659659
660- if GitInfo :: new ( false , submodule) . is_managed_git_subrepository ( ) {
660+ if GitInfo :: new ( false , Path :: new ( submodule) ) . is_managed_git_subrepository ( ) {
661661 self . update_submodule ( submodule) ;
662662 }
663663 }
0 commit comments