@@ -441,7 +441,7 @@ impl Build {
441
441
// Cargo.toml files.
442
442
let rust_submodules = [ "library/backtrace" , "library/stdarch" ] ;
443
443
for s in rust_submodules {
444
- build. update_submodule ( Path :: new ( s ) ) ;
444
+ build. update_submodule ( s ) ;
445
445
}
446
446
// Now, update all existing submodules.
447
447
build. update_existing_submodules ( ) ;
@@ -479,7 +479,7 @@ impl Build {
479
479
/// tarball). Typically [`Build::require_and_update_submodule`] should be
480
480
/// used instead to provide a nice error to the user if the submodule is
481
481
/// missing.
482
- fn update_submodule ( & self , relative_path : & Path ) {
482
+ fn update_submodule ( & self , relative_path : & str ) {
483
483
if !self . config . submodules ( ) {
484
484
return ;
485
485
}
@@ -527,7 +527,7 @@ impl Build {
527
527
return ;
528
528
}
529
529
530
- println ! ( "Updating submodule {}" , relative_path . display ( ) ) ;
530
+ println ! ( "Updating submodule {relative_path}" ) ;
531
531
helpers:: git ( Some ( & self . src ) )
532
532
. run_always ( )
533
533
. args ( [ "submodule" , "-q" , "sync" ] )
@@ -596,9 +596,8 @@ impl Build {
596
596
if cfg ! ( test) && !self . config . submodules ( ) {
597
597
return ;
598
598
}
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) ;
602
601
if dir_is_empty ( & absolute_path) {
603
602
let maybe_enable = if !self . config . submodules ( )
604
603
&& self . config . rust_info . is_managed_git_subrepository ( )
@@ -642,22 +641,23 @@ impl Build {
642
641
for line in output. lines ( ) {
643
642
// Look for `submodule.$name.path = $path`
644
643
// 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) ;
646
646
// 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 ( ) {
648
648
self . update_submodule ( submodule) ;
649
649
}
650
650
}
651
651
}
652
652
653
653
/// 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 ) {
655
655
// Avoid running git when there isn't a git checkout.
656
656
if !self . config . submodules ( ) {
657
657
return ;
658
658
}
659
659
660
- if GitInfo :: new ( false , submodule) . is_managed_git_subrepository ( ) {
660
+ if GitInfo :: new ( false , Path :: new ( submodule) ) . is_managed_git_subrepository ( ) {
661
661
self . update_submodule ( submodule) ;
662
662
}
663
663
}
0 commit comments