@@ -2658,9 +2658,11 @@ mod tests {
26582658 use super :: Options ;
26592659
26602660 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+
26642666 ExternEntry {
26652667 locations,
26662668 is_private_dep : false
@@ -2680,10 +2682,6 @@ mod tests {
26802682 BTreeMap :: from_iter ( entries. into_iter ( ) )
26812683 }
26822684
2683- fn mk_set < V : Ord > ( entries : Vec < V > ) -> BTreeSet < V > {
2684- BTreeSet :: from_iter ( entries. into_iter ( ) )
2685- }
2686-
26872685 // When the user supplies --test we should implicitly supply --cfg test
26882686 #[ test]
26892687 fn test_switch_implies_cfg_test ( ) {
@@ -2801,45 +2799,33 @@ mod tests {
28012799 v1. externs = Externs :: new ( mk_map ( vec ! [
28022800 (
28032801 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" ) ] )
28072803 ) ,
28082804 (
28092805 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" ) ] )
28132807 ) ,
28142808 ] ) ) ;
28152809
28162810 v2. externs = Externs :: new ( mk_map ( vec ! [
28172811 (
28182812 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" ) ] )
28222814 ) ,
28232815 (
28242816 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" ) ] )
28282818 ) ,
28292819 ] ) ) ;
28302820
28312821 v3. externs = Externs :: new ( mk_map ( vec ! [
28322822 (
28332823 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" ) ] )
28372825 ) ,
28382826 (
28392827 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" ) ] )
28432829 ) ,
28442830 ] ) ) ;
28452831
0 commit comments