]> git.lizzy.rs Git - rust.git/blobdiff - src/libextra/test.rs
librustc: Remove unique vector patterns from the language.
[rust.git] / src / libextra / test.rs
index 4498ec3111718053831534ae10f19799349a31f3..4b883d1498683f36b1649bf0bd857acbc1de9317 100644 (file)
@@ -315,12 +315,15 @@ pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
     match maybestr {
         None => None,
         Some(s) => {
-            match s.split('.').to_owned_vec() {
-                [a, b] => match (from_str::<uint>(a), from_str::<uint>(b)) {
-                    (Some(a), Some(b)) => Some((a,b)),
+            let vector = s.split('.').to_owned_vec();
+            if vector.len() == 2 {
+                match (from_str::<uint>(vector[0]),
+                       from_str::<uint>(vector[1])) {
+                    (Some(a), Some(b)) => Some((a, b)),
                     _ => None
-                },
-                _ => None
+                }
+            } else {
+                None
             }
         }
     }