@@ -182,7 +182,7 @@ impl Metadata {
182182 }
183183
184184 pub ( super ) fn targets ( & self ) -> BuildTargets < ' _ > {
185- use super :: rustwide_builder:: { HOST_TARGET , TARGETS } ;
185+ use super :: rustwide_builder:: HOST_TARGET ;
186186
187187 let default_target = self
188188 . default_target
@@ -200,7 +200,7 @@ impl Metadata {
200200 . targets
201201 . as_ref ( )
202202 . map ( |targets| targets. iter ( ) . map ( String :: as_str) . collect ( ) )
203- . unwrap_or_else ( || TARGETS . iter ( ) . copied ( ) . collect ( ) ) ;
203+ . unwrap_or_default ( ) ;
204204
205205 targets. remove ( & default_target) ;
206206 BuildTargets {
@@ -302,24 +302,9 @@ mod test {
302302 let mut metadata = Metadata :: default ( ) ;
303303
304304 // unchanged default_target, targets not specified
305- let BuildTargets {
306- default_target : default,
307- other_targets : tier_one,
308- } = metadata. targets ( ) ;
305+ let BuildTargets { default_target : default, other_targets } = metadata. targets ( ) ;
309306 assert_eq ! ( default , HOST_TARGET ) ;
310-
311- // should be equal to TARGETS \ {HOST_TARGET}
312- for actual in & tier_one {
313- assert ! ( TARGETS . contains( actual) ) ;
314- }
315-
316- for expected in TARGETS {
317- if * expected == HOST_TARGET {
318- assert ! ( !tier_one. contains( & HOST_TARGET ) ) ;
319- } else {
320- assert ! ( tier_one. contains( expected) ) ;
321- }
322- }
307+ assert ! ( other_targets. is_empty( ) ) ;
323308
324309 // unchanged default_target, targets specified to be empty
325310 metadata. targets = Some ( Vec :: new ( ) ) ;
@@ -392,20 +377,10 @@ mod test {
392377 assert_eq ! ( default , "i686-apple-darwin" ) ;
393378 assert ! ( others. is_empty( ) ) ;
394379
395- // and if `targets` is unset, it should still be set to `TARGETS`
380+ // if `targets` is unset, don't build any extra targets
396381 metadata. targets = None ;
397- let BuildTargets {
398- default_target : default,
399- other_targets : others,
400- } = metadata. targets ( ) ;
401-
382+ let BuildTargets { default_target : default, other_targets } = metadata. targets ( ) ;
402383 assert_eq ! ( default , "i686-apple-darwin" ) ;
403- let tier_one_targets_no_default = TARGETS
404- . iter ( )
405- . filter ( |& & t| t != "i686-apple-darwin" )
406- . copied ( )
407- . collect ( ) ;
408-
409- assert_eq ! ( others, tier_one_targets_no_default) ;
384+ assert ! ( other_targets. is_empty( ) ) ;
410385 }
411386}
0 commit comments