@@ -24,14 +24,18 @@ pub struct CleanOptions<'a> {
24
24
25
25
/// Cleans the package's build artifacts.
26
26
pub fn clean ( ws : & Workspace , opts : & CleanOptions ) -> CargoResult < ( ) > {
27
- let target_dir = ws. target_dir ( ) ;
27
+ let mut target_dir = ws. target_dir ( ) ;
28
28
let config = ws. config ( ) ;
29
29
30
30
// If the doc option is set, we just want to delete the doc directory.
31
31
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" ) ;
35
39
}
36
40
37
41
// 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<()> {
40
44
// Note that we don't bother grabbing a lock here as we're just going to
41
45
// blow it all away anyway.
42
46
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) ;
45
48
}
46
49
47
50
let ( packages, resolve) = ops:: resolve_ws ( ws) ?;
0 commit comments