@@ -2686,9 +2686,11 @@ mod tests {
2686
2686
use super :: Options ;
2687
2687
2688
2688
impl ExternEntry {
2689
- fn new_public ( location : Option < String > ) -> ExternEntry {
2690
- let mut locations = BTreeSet :: new ( ) ;
2691
- locations. insert ( location) ;
2689
+ fn new_public < S : Into < String > ,
2690
+ I : IntoIterator < Item = Option < S > > > ( locations : I ) -> ExternEntry {
2691
+ let locations: BTreeSet < _ > = locations. into_iter ( ) . map ( |o| o. map ( |s| s. into ( ) ) )
2692
+ . collect ( ) ;
2693
+
2692
2694
ExternEntry {
2693
2695
locations,
2694
2696
is_private_dep : false
@@ -2708,10 +2710,6 @@ mod tests {
2708
2710
BTreeMap :: from_iter ( entries. into_iter ( ) )
2709
2711
}
2710
2712
2711
- fn mk_set < V : Ord > ( entries : Vec < V > ) -> BTreeSet < V > {
2712
- BTreeSet :: from_iter ( entries. into_iter ( ) )
2713
- }
2714
-
2715
2713
// When the user supplies --test we should implicitly supply --cfg test
2716
2714
#[ test]
2717
2715
fn test_switch_implies_cfg_test ( ) {
@@ -2829,45 +2827,33 @@ mod tests {
2829
2827
v1. externs = Externs :: new ( mk_map ( vec ! [
2830
2828
(
2831
2829
String :: from( "a" ) ,
2832
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2833
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2834
- ] ) ,
2830
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2835
2831
) ,
2836
2832
(
2837
2833
String :: from( "d" ) ,
2838
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "e" ) ) ) ,
2839
- ExternEntry :: new_public( Some ( String :: from( "f" ) ) )
2840
- ] ) ,
2834
+ ExternEntry :: new_public( vec![ Some ( "e" ) , Some ( "f" ) ] )
2841
2835
) ,
2842
2836
] ) ) ;
2843
2837
2844
2838
v2. externs = Externs :: new ( mk_map ( vec ! [
2845
2839
(
2846
2840
String :: from( "d" ) ,
2847
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "e" ) ) ) ,
2848
- ExternEntry :: new_public( Some ( String :: from( "f" ) ) )
2849
- ] ) ,
2841
+ ExternEntry :: new_public( vec![ Some ( "e" ) , Some ( "f" ) ] )
2850
2842
) ,
2851
2843
(
2852
2844
String :: from( "a" ) ,
2853
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2854
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2855
- ] ) ,
2845
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2856
2846
) ,
2857
2847
] ) ) ;
2858
2848
2859
2849
v3. externs = Externs :: new ( mk_map ( vec ! [
2860
2850
(
2861
2851
String :: from( "a" ) ,
2862
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "b" ) ) ) ,
2863
- ExternEntry :: new_public( Some ( String :: from( "c" ) ) )
2864
- ] ) ,
2852
+ ExternEntry :: new_public( vec![ Some ( "b" ) , Some ( "c" ) ] )
2865
2853
) ,
2866
2854
(
2867
2855
String :: from( "d" ) ,
2868
- mk_set( vec![ ExternEntry :: new_public( Some ( String :: from( "f" ) ) ) ,
2869
- ExternEntry :: new_public( Some ( String :: from( "e" ) ) )
2870
- ] ) ,
2856
+ ExternEntry :: new_public( vec![ Some ( "f" ) , Some ( "e" ) ] )
2871
2857
) ,
2872
2858
] ) ) ;
2873
2859
0 commit comments