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 @@ -707,13 +707,19 @@ fn clean_dry_run() {
707
707
// Start with no files.
708
708
p. cargo ( "clean --dry-run" )
709
709
. with_stdout ( "" )
710
- . with_stderr ( "[SUMMARY] 0 files" )
710
+ . with_stderr (
711
+ "[SUMMARY] 0 files\n \
712
+ [WARNING] no files deleted due to --dry-run",
713
+ )
711
714
. run ( ) ;
712
715
p. cargo ( "check" ) . run ( ) ;
713
716
let before = ls_r ( ) ;
714
717
p. cargo ( "clean --dry-run" )
715
718
. with_stdout ( "[CWD]/target" )
716
- . with_stderr ( "[SUMMARY] [..] files, [..] total" )
719
+ . with_stderr (
720
+ "[SUMMARY] [..] files, [..] total\n \
721
+ [WARNING] no files deleted due to --dry-run",
722
+ )
717
723
. run ( ) ;
718
724
// Verify it didn't delete anything.
719
725
let after = ls_r ( ) ;
@@ -723,7 +729,10 @@ fn clean_dry_run() {
723
729
// Verify the verbose output.
724
730
p. cargo ( "clean --dry-run -v" )
725
731
. with_stdout_unordered ( expected)
726
- . with_stderr ( "[SUMMARY] [..] files, [..] total" )
732
+ . with_stderr (
733
+ "[SUMMARY] [..] files, [..] total\n \
734
+ [WARNING] no files deleted due to --dry-run",
735
+ )
727
736
. run ( ) ;
728
737
}
729
738
You can’t perform that action at this time.
0 commit comments