about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2019-04-08 23:22:22 -0400
committerAaron Hill <aa1ronham@gmail.com>2019-04-14 15:45:18 -0400
commit872c20d41569ab42eda5741d6e2a463a2b385c56 (patch)
treeb942986adbb70344ed4bcce439a1a674e06b3604 /src
parent724f6a11b3b9ea7c267c8f009f2e6958e6286e5f (diff)
downloadrust-872c20d41569ab42eda5741d6e2a463a2b385c56.tar.gz
rust-872c20d41569ab42eda5741d6e2a463a2b385c56.zip
Fix ExternEntry test
Diffstat (limited to 'src')
-rw-r--r--src/librustc/session/config.rs36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 9bc9c7cbbe3..00dfe9aca39 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -2686,9 +2686,11 @@ mod tests {
     use super::Options;
 
     impl ExternEntry {
-        fn new_public(location: Option<String>) -> ExternEntry {
-            let mut locations = BTreeSet::new();
-            locations.insert(location);
+        fn new_public<S: Into<String>,
+                      I: IntoIterator<Item = Option<S>>>(locations: I) -> ExternEntry {
+            let locations: BTreeSet<_> = locations.into_iter().map(|o| o.map(|s| s.into()))
+                .collect();
+
             ExternEntry {
                 locations,
                 is_private_dep: false
@@ -2708,10 +2710,6 @@ mod tests {
         BTreeMap::from_iter(entries.into_iter())
     }
 
-    fn mk_set<V: Ord>(entries: Vec<V>) -> BTreeSet<V> {
-        BTreeSet::from_iter(entries.into_iter())
-    }
-
     // When the user supplies --test we should implicitly supply --cfg test
     #[test]
     fn test_switch_implies_cfg_test() {
@@ -2829,45 +2827,33 @@ mod tests {
         v1.externs = Externs::new(mk_map(vec![
             (
                 String::from("a"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
-                            ExternEntry::new_public(Some(String::from("c")))
-                            ]),
+                ExternEntry::new_public(vec![Some("b"), Some("c")])
             ),
             (
                 String::from("d"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("e"))),
-                            ExternEntry::new_public(Some(String::from("f")))
-                            ]),
+                ExternEntry::new_public(vec![Some("e"), Some("f")])
             ),
         ]));
 
         v2.externs = Externs::new(mk_map(vec![
             (
                 String::from("d"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("e"))),
-                            ExternEntry::new_public(Some(String::from("f")))
-                            ]),
+                ExternEntry::new_public(vec![Some("e"), Some("f")])
             ),
             (
                 String::from("a"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
-                            ExternEntry::new_public(Some(String::from("c")))
-                            ]),
+                ExternEntry::new_public(vec![Some("b"), Some("c")])
             ),
         ]));
 
         v3.externs = Externs::new(mk_map(vec![
             (
                 String::from("a"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
-                            ExternEntry::new_public(Some(String::from("c")))
-                            ]),
+                ExternEntry::new_public(vec![Some("b"), Some("c")])
             ),
             (
                 String::from("d"),
-                mk_set(vec![ExternEntry::new_public(Some(String::from("f"))),
-                            ExternEntry::new_public(Some(String::from("e")))
-                            ]),
+                ExternEntry::new_public(vec![Some("f"), Some("e")])
             ),
         ]));