about summary refs log tree commit diff
path: root/src/libstd/time.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-08-15 11:55:17 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-08-15 12:38:32 -0700
commit51d98d9c7bcdfad2daec697739b25193adc09ced (patch)
treec4ae164ad57499113d0cc2e4b82f6406acb82e1f /src/libstd/time.rs
parentb0f289397ce47ed8c4d4f97d94408e83a59abd5a (diff)
downloadrust-51d98d9c7bcdfad2daec697739b25193adc09ced.tar.gz
rust-51d98d9c7bcdfad2daec697739b25193adc09ced.zip
Expunge match checks
Diffstat (limited to 'src/libstd/time.rs')
-rw-r--r--src/libstd/time.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index 47dbff2ccb1..1aa6c4d74da 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -572,26 +572,30 @@ fn strptime(s: ~str, format: ~str) -> result<tm, ~str> {
 fn strftime(format: ~str, tm: tm) -> ~str {
     fn parse_type(ch: char, tm: tm) -> ~str {
         //FIXME (#2350): Implement missing types.
-        match check ch {
-          'A' => match check tm.tm_wday as int {
+      let die = || #fmt("strftime: can't understand this format %c ",
+                             ch);
+        match ch {
+          'A' => match tm.tm_wday as int {
             0 => ~"Sunday",
             1 => ~"Monday",
             2 => ~"Tuesday",
             3 => ~"Wednesday",
             4 => ~"Thursday",
             5 => ~"Friday",
-            6 => ~"Saturday"
+            6 => ~"Saturday",
+            _ => die()
           },
-          'a' => match check tm.tm_wday as int {
+         'a' => match tm.tm_wday as int {
             0 => ~"Sun",
             1 => ~"Mon",
             2 => ~"Tue",
             3 => ~"Wed",
             4 => ~"Thu",
             5 => ~"Fri",
-            6 => ~"Sat"
+            6 => ~"Sat",
+            _ => die()
           },
-          'B' => match check tm.tm_mon as int {
+          'B' => match tm.tm_mon as int {
             0 => ~"January",
             1 => ~"February",
             2 => ~"March",
@@ -603,9 +607,10 @@ fn strftime(format: ~str, tm: tm) -> ~str {
             8 => ~"September",
             9 => ~"October",
             10 => ~"November",
-            11 => ~"December"
+            11 => ~"December",
+            _ => die()
           },
-          'b' | 'h' => match check tm.tm_mon as int {
+          'b' | 'h' => match tm.tm_mon as int {
             0 => ~"Jan",
             1 => ~"Feb",
             2 => ~"Mar",
@@ -618,6 +623,7 @@ fn strftime(format: ~str, tm: tm) -> ~str {
             9 => ~"Oct",
             10 => ~"Nov",
             11 => ~"Dec",
+            _  => die()
           },
           'C' => fmt!{"%02d", (tm.tm_year as int + 1900) / 100},
           'c' => {
@@ -712,7 +718,8 @@ fn strftime(format: ~str, tm: tm) -> ~str {
             fmt!{"%c%02d%02d", sign, h as int, m as int}
           }
           //'+' {}
-          '%' => ~"%"
+          '%' => ~"%",
+          _   => die()
         }
     }