about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-02-13 09:46:46 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-02-19 16:35:31 -0800
commit33923f47e3f90442ae3c604d8ea80992b71611f7 (patch)
tree4130c674d6114c3b6a7399b599e98cf62fca3aac /src/libextra
parentea0058281cfea06a61e5eb23b31c15e9d1dcfda3 (diff)
downloadrust-33923f47e3f90442ae3c604d8ea80992b71611f7.tar.gz
rust-33923f47e3f90442ae3c604d8ea80992b71611f7.zip
librustc: Remove unique vector patterns from the language.
Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/test.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index 4498ec31117..4b883d14986 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -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
             }
         }
     }