@@ -196,52 +196,49 @@ fn clean_specs(
196196 for pkg in packages {
197197 clean_ctx. progress . on_cleaning_package ( & pkg. name ( ) ) ?;
198198
199- if clean_ctx. gctx . cli_unstable ( ) . build_dir_new_layout {
200- for ( _compile_kind, layout) in & layouts_with_host {
201- let dir = layout. build_dir ( ) . build_unit ( & pkg. name ( ) ) ;
202- clean_ctx. rm_rf ( & dir) ?;
203- }
199+ for ( _compile_kind, layout) in & layouts_with_host {
200+ let dir = layout. build_dir ( ) . build_unit ( & pkg. name ( ) ) ;
201+ clean_ctx. rm_rf ( & dir) ?;
202+ }
204203
205- for target in pkg. targets ( ) {
206- if target. is_custom_build ( ) {
207- continue ;
208- }
209- for & mode in & [
210- CompileMode :: Build ,
211- CompileMode :: Test ,
212- CompileMode :: Check { test : false } ,
213- ] {
214- for ( compile_kind, layout) in & layouts {
215- let triple = target_data. short_name ( compile_kind) ;
216- let ( file_types, _unsupported) = target_data
217- . info ( * compile_kind)
218- . rustc_outputs ( mode, target. kind ( ) , triple, clean_ctx. gctx ) ?;
219- let artifact_dir = layout
220- . artifact_dir ( )
221- . expect ( "artifact-dir was not locked during clean" ) ;
222- let uplift_dir = match target. kind ( ) {
223- TargetKind :: ExampleBin | TargetKind :: ExampleLib ( ..) => {
224- Some ( artifact_dir. examples ( ) )
225- }
226- // Tests/benchmarks are never uplifted.
227- TargetKind :: Test | TargetKind :: Bench => None ,
228- _ => Some ( artifact_dir. dest ( ) ) ,
229- } ;
230- // Remove the uplifted copy.
231- if let Some ( uplift_dir) = uplift_dir {
232- for file_type in file_types {
233- let uplifted_path =
234- uplift_dir. join ( file_type. uplift_filename ( target) ) ;
235- clean_ctx. rm_rf ( & uplifted_path) ?;
236- // Dep-info generated by Cargo itself.
237- let dep_info = uplifted_path. with_extension ( "d" ) ;
238- clean_ctx. rm_rf ( & dep_info) ?;
239- }
204+ for target in pkg. targets ( ) {
205+ if target. is_custom_build ( ) {
206+ continue ;
207+ }
208+ for & mode in & [
209+ CompileMode :: Build ,
210+ CompileMode :: Test ,
211+ CompileMode :: Check { test : false } ,
212+ ] {
213+ for ( compile_kind, layout) in & layouts {
214+ let triple = target_data. short_name ( compile_kind) ;
215+ let ( file_types, _unsupported) = target_data
216+ . info ( * compile_kind)
217+ . rustc_outputs ( mode, target. kind ( ) , triple, clean_ctx. gctx ) ?;
218+ let artifact_dir = layout
219+ . artifact_dir ( )
220+ . expect ( "artifact-dir was not locked during clean" ) ;
221+ let uplift_dir = match target. kind ( ) {
222+ TargetKind :: ExampleBin | TargetKind :: ExampleLib ( ..) => {
223+ Some ( artifact_dir. examples ( ) )
224+ }
225+ // Tests/benchmarks are never uplifted.
226+ TargetKind :: Test | TargetKind :: Bench => None ,
227+ _ => Some ( artifact_dir. dest ( ) ) ,
228+ } ;
229+ // Remove the uplifted copy.
230+ if let Some ( uplift_dir) = uplift_dir {
231+ for file_type in file_types {
232+ let uplifted_path =
233+ uplift_dir. join ( file_type. uplift_filename ( target) ) ;
234+ clean_ctx. rm_rf ( & uplifted_path) ?;
235+ // Dep-info generated by Cargo itself.
236+ let dep_info = uplifted_path. with_extension ( "d" ) ;
237+ clean_ctx. rm_rf ( & dep_info) ?;
240238 }
241239 }
242240 }
243241 }
244- continue ;
245242 }
246243 }
247244 } else {
0 commit comments