File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,13 @@ impl<'cfg> CleanContext<'cfg> {
417
417
} ;
418
418
self . config
419
419
. shell ( )
420
- . status ( status, format ! ( "{file_count}{byte_count}" ) )
420
+ . status ( status, format ! ( "{file_count}{byte_count}" ) ) ?;
421
+ if self . dry_run {
422
+ self . config
423
+ . shell ( )
424
+ . warn ( "no files deleted due to --dry-run" ) ?;
425
+ }
426
+ Ok ( ( ) )
421
427
}
422
428
423
429
/// Deletes all of the given paths, showing a progress bar as it proceeds.
Original file line number Diff line number Diff line change @@ -817,13 +817,19 @@ fn clean_dry_run() {
817
817
// Start with no files.
818
818
p. cargo ( "clean --dry-run" )
819
819
. with_stdout ( "" )
820
- . with_stderr ( "[SUMMARY] 0 files" )
820
+ . with_stderr (
821
+ "[SUMMARY] 0 files\n \
822
+ [WARNING] no files deleted due to --dry-run",
823
+ )
821
824
. run ( ) ;
822
825
p. cargo ( "check" ) . run ( ) ;
823
826
let before = ls_r ( ) ;
824
827
p. cargo ( "clean --dry-run" )
825
828
. with_stdout ( "[CWD]/target" )
826
- . with_stderr ( "[SUMMARY] [..] files, [..] total" )
829
+ . with_stderr (
830
+ "[SUMMARY] [..] files, [..] total\n \
831
+ [WARNING] no files deleted due to --dry-run",
832
+ )
827
833
. run ( ) ;
828
834
// Verify it didn't delete anything.
829
835
let after = ls_r ( ) ;
@@ -833,7 +839,10 @@ fn clean_dry_run() {
833
839
// Verify the verbose output.
834
840
p. cargo ( "clean --dry-run -v" )
835
841
. with_stdout_unordered ( expected)
836
- . with_stderr ( "[SUMMARY] [..] files, [..] total" )
842
+ . with_stderr (
843
+ "[SUMMARY] [..] files, [..] total\n \
844
+ [WARNING] no files deleted due to --dry-run",
845
+ )
837
846
. run ( ) ;
838
847
}
839
848
You can’t perform that action at this time.
0 commit comments