@@ -24,14 +24,18 @@ pub struct CleanOptions<'a> {
2424
2525/// Cleans the package's build artifacts.
2626pub fn clean ( ws : & Workspace , opts : & CleanOptions ) -> CargoResult < ( ) > {
27- let target_dir = ws. target_dir ( ) ;
27+ let mut target_dir = ws. target_dir ( ) ;
2828 let config = ws. config ( ) ;
2929
3030 // If the doc option is set, we just want to delete the doc directory.
3131 if opts. doc {
32- let target_dir = target_dir. join ( "doc" ) ;
33- let target_dir = target_dir. into_path_unlocked ( ) ;
34- return rm_rf ( & target_dir, config) ;
32+ target_dir = target_dir. join ( "doc" ) ;
33+ return rm_rf ( & target_dir. into_path_unlocked ( ) , config) ;
34+ }
35+
36+ // If the release option is set, we set target to release directory
37+ if opts. release {
38+ target_dir = target_dir. join ( "release" ) ;
3539 }
3640
3741 // If we have a spec, then we need to delete some packages, otherwise, just
@@ -40,8 +44,7 @@ pub fn clean(ws: &Workspace, opts: &CleanOptions) -> CargoResult<()> {
4044 // Note that we don't bother grabbing a lock here as we're just going to
4145 // blow it all away anyway.
4246 if opts. spec . is_empty ( ) {
43- let target_dir = target_dir. into_path_unlocked ( ) ;
44- return rm_rf ( & target_dir, config) ;
47+ return rm_rf ( & target_dir. into_path_unlocked ( ) , config) ;
4548 }
4649
4750 let ( packages, resolve) = ops:: resolve_ws ( ws) ?;
0 commit comments