@@ -2658,9 +2658,11 @@ mod tests {
2658
2658
use super :: Options ;
2659
2659
2660
2660
impl ExternEntry {
2661
- fn new_public ( location : Option < String > ) -> ExternEntry {
2662
- let mut locations = BTreeSet :: new ( ) ;
2663
- locations. insert ( location) ;
2661
+ fn new_public < S : Into < String > ,
2662
+ I : IntoIterator < Item = Option < S > > > ( locations : I ) -> ExternEntry {
2663
+ let locations: BTreeSet < _ > = locations. into_iter ( ) . map ( |o| o. map ( |s| s. into ( ) ) )
2664
+ . collect ( ) ;
2665
+
2664
2666
ExternEntry {
2665
2667
locations,
2666
2668
is_private_dep : false
@@ -2680,10 +2682,6 @@ mod tests {
2680
2682
BTreeMap :: from_iter ( entries. into_iter ( ) )
2681
2683
}
2682
2684
2683
- fn mk_set < V : Ord > ( entries : Vec < V > ) -> BTreeSet < V > {
2684
- BTreeSet :: from_iter ( entries. into_iter ( ) )
2685
- }
2686
-
2687
2685
// When the user supplies --test we should implicitly supply --cfg test
2688
2686
#[ test]
2689
2687
fn test_switch_implies_cfg_test ( ) {
@@ -2801,45 +2799,33 @@ mod tests {
2801
2799
v1. externs = Externs :: new ( mk_map ( vec ! [
2802
2800
(
2803
2801
String :: from( "a" ) ,
2804
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2805
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2806
- ] ) ,
2802
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2807
2803
) ,
2808
2804
(
2809
2805
String :: from( "d" ) ,
2810
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "e" ) ) ) ,
2811
- ExternEntry :: new_public( Some ( String :: from( "f" ) ) )
2812
- ] ) ,
2806
+ ExternEntry :: new_public( vec![ Some ( "e" ) , Some ( "f" ) ] )
2813
2807
) ,
2814
2808
] ) ) ;
2815
2809
2816
2810
v2. externs = Externs :: new ( mk_map ( vec ! [
2817
2811
(
2818
2812
String :: from( "d" ) ,
2819
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "e" ) ) ) ,
2820
- ExternEntry :: new_public( Some ( String :: from( "f" ) ) )
2821
- ] ) ,
2813
+ ExternEntry :: new_public( vec![ Some ( "e" ) , Some ( "f" ) ] )
2822
2814
) ,
2823
2815
(
2824
2816
String :: from( "a" ) ,
2825
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2826
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2827
- ] ) ,
2817
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2828
2818
) ,
2829
2819
] ) ) ;
2830
2820
2831
2821
v3. externs = Externs :: new ( mk_map ( vec ! [
2832
2822
(
2833
2823
String :: from( "a" ) ,
2834
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2835
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2836
- ] ) ,
2824
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2837
2825
) ,
2838
2826
(
2839
2827
String :: from( "d" ) ,
2840
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "f" ) ) ) ,
2841
- ExternEntry :: new_public( Some ( String :: from( "e" ) ) )
2842
- ] ) ,
2828
+ ExternEntry :: new_public( vec![ Some ( "f" ) , Some ( "e" ) ] )
2843
2829
) ,
2844
2830
] ) ) ;
2845
2831
0 commit comments