@@ -297,7 +297,7 @@ impl<'gctx> InstallablePackage<'gctx> {
297
297
Ok ( duplicates)
298
298
}
299
299
300
- fn install_one ( mut self ) -> CargoResult < bool > {
300
+ fn install_one ( mut self , dry_run : bool ) -> CargoResult < bool > {
301
301
self . gctx . shell ( ) . status ( "Installing" , & self . pkg ) ?;
302
302
303
303
let dst = self . root . join ( "bin" ) . into_path_unlocked ( ) ;
@@ -321,6 +321,7 @@ impl<'gctx> InstallablePackage<'gctx> {
321
321
self . check_yanked_install ( ) ?;
322
322
323
323
let exec: Arc < dyn Executor > = Arc :: new ( DefaultExecutor ) ;
324
+ self . opts . build_config . dry_run = dry_run;
324
325
let compile = ops:: compile_ws ( & self . ws , & self . opts , & exec) . with_context ( || {
325
326
if let Some ( td) = td_opt. take ( ) {
326
327
// preserve the temporary directory, so the user can inspect it
@@ -385,7 +386,7 @@ impl<'gctx> InstallablePackage<'gctx> {
385
386
. iter ( )
386
387
. filter ( |t| t. is_executable ( ) )
387
388
. collect ( ) ;
388
- if !binaries. is_empty ( ) {
389
+ if !binaries. is_empty ( ) && !dry_run {
389
390
self . gctx
390
391
. shell ( )
391
392
. warn ( make_warning_about_missing_features ( & binaries) ) ?;
@@ -620,6 +621,7 @@ pub fn install(
620
621
opts : & ops:: CompileOptions ,
621
622
force : bool ,
622
623
no_track : bool ,
624
+ dry_run : bool ,
623
625
) -> CargoResult < ( ) > {
624
626
let root = resolve_root ( root, gctx) ?;
625
627
let dst = root. join ( "bin" ) . into_path_unlocked ( ) ;
@@ -654,7 +656,7 @@ pub fn install(
654
656
) ?;
655
657
let mut installed_anything = true ;
656
658
if let Some ( installable_pkg) = installable_pkg {
657
- installed_anything = installable_pkg. install_one ( ) ?;
659
+ installed_anything = installable_pkg. install_one ( dry_run ) ?;
658
660
}
659
661
( installed_anything, false )
660
662
} else {
@@ -705,7 +707,7 @@ pub fn install(
705
707
706
708
let install_results: Vec < _ > = pkgs_to_install
707
709
. into_iter ( )
708
- . map ( |( krate, installable_pkg) | ( krate, installable_pkg. install_one ( ) ) )
710
+ . map ( |( krate, installable_pkg) | ( krate, installable_pkg. install_one ( dry_run ) ) )
709
711
. collect ( ) ;
710
712
711
713
for ( krate, result) in install_results {
@@ -745,7 +747,7 @@ pub fn install(
745
747
let path = gctx. get_env_os ( "PATH" ) . unwrap_or_default ( ) ;
746
748
let dst_in_path = env:: split_paths ( & path) . any ( |path| path == dst) ;
747
749
748
- if !dst_in_path {
750
+ if !dst_in_path && !dry_run {
749
751
gctx. shell ( ) . warn ( & format ! (
750
752
"be sure to add `{}` to your PATH to be \
751
753
able to run the installed binaries",
0 commit comments