about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-28 00:19:21 -0700
committerbors <bors@rust-lang.org>2013-07-28 00:19:21 -0700
commit20454da2db9903688dfd60b826cc704de79767bc (patch)
treea20efcf40ca3c0473aca0b8c42383cd0bcf65ce1 /src/libextra
parent9325535b41fa5a7cfac697e86ae86bd1384542e6 (diff)
parentb147d70b08f93ea0a13a5331f413d547819b2f4c (diff)
downloadrust-20454da2db9903688dfd60b826cc704de79767bc.tar.gz
rust-20454da2db9903688dfd60b826cc704de79767bc.zip
auto merge of #8069 : erickt/rust/maikklein, r=erickt
Good evening,

This is a superset of @MaikKlein's #7969 commit, that I've fixed up to compile. I had a couple commits I wanted to do on top of @MaikKlein's work that I didn't want to bitrot.
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/json.rs19
-rw-r--r--src/libextra/time.rs8
-rw-r--r--src/libextra/workcache.rs3
3 files changed, 14 insertions, 16 deletions
diff --git a/src/libextra/json.rs b/src/libextra/json.rs
index 6a7f0607dd6..4cd67d6ebac 100644
--- a/src/libextra/json.rs
+++ b/src/libextra/json.rs
@@ -1867,27 +1867,26 @@ mod tests {
                 col: 8u,
                 msg: @~"EOF while parsing object"}));
 
-        assert_eq!(result::unwrap(from_str("{}")), mk_object([]));
-        assert_eq!(result::unwrap(from_str("{\"a\": 3}")),
+        assert_eq!(from_str("{}").unwrap(), mk_object([]));
+        assert_eq!(from_str("{\"a\": 3}").unwrap(),
                   mk_object([(~"a", Number(3.0f))]));
 
-        assert_eq!(result::unwrap(from_str(
-                      "{ \"a\": null, \"b\" : true }")),
+        assert_eq!(from_str(
+                      "{ \"a\": null, \"b\" : true }").unwrap(),
                   mk_object([
                       (~"a", Null),
                       (~"b", Boolean(true))]));
-        assert_eq!(result::unwrap(
-                      from_str("\n{ \"a\": null, \"b\" : true }\n")),
+        assert_eq!(from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(),
                   mk_object([
                       (~"a", Null),
                       (~"b", Boolean(true))]));
-        assert_eq!(result::unwrap(from_str(
-                      "{\"a\" : 1.0 ,\"b\": [ true ]}")),
+        assert_eq!(from_str(
+                      "{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(),
                   mk_object([
                       (~"a", Number(1.0)),
                       (~"b", List(~[Boolean(true)]))
                   ]));
-        assert_eq!(result::unwrap(from_str(
+        assert_eq!(from_str(
                       ~"{" +
                           "\"a\": 1.0, " +
                           "\"b\": [" +
@@ -1895,7 +1894,7 @@ mod tests {
                               "\"foo\\nbar\", " +
                               "{ \"c\": {\"d\": null} } " +
                           "]" +
-                      "}")),
+                      "}").unwrap(),
                   mk_object([
                       (~"a", Number(1.0f)),
                       (~"b", List(~[
diff --git a/src/libextra/time.rs b/src/libextra/time.rs
index b1c07e83f52..f926572dad6 100644
--- a/src/libextra/time.rs
+++ b/src/libextra/time.rs
@@ -1132,13 +1132,13 @@ mod tests {
         assert!(test("6", "%w"));
         assert!(test("2009", "%Y"));
         assert!(test("09", "%y"));
-        assert!(result::unwrap(strptime("UTC", "%Z")).tm_zone ==
+        assert!(strptime("UTC", "%Z").unwrap().tm_zone ==
             ~"UTC");
-        assert!(result::unwrap(strptime("PST", "%Z")).tm_zone ==
+        assert!(strptime("PST", "%Z").unwrap().tm_zone ==
             ~"");
-        assert!(result::unwrap(strptime("-0000", "%z")).tm_gmtoff ==
+        assert!(strptime("-0000", "%z").unwrap().tm_gmtoff ==
             0);
-        assert!(result::unwrap(strptime("-0800", "%z")).tm_gmtoff ==
+        assert!(strptime("-0800", "%z").unwrap().tm_gmtoff ==
             0);
         assert!(test("%", "%%"));
 
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs
index 125f3a5cd4a..13a8ad36388 100644
--- a/src/libextra/workcache.rs
+++ b/src/libextra/workcache.rs
@@ -22,7 +22,6 @@ use std::cell::Cell;
 use std::comm::{PortOne, oneshot, send_one, recv_one};
 use std::either::{Either, Left, Right};
 use std::io;
-use std::result;
 use std::run;
 use std::task;
 
@@ -208,7 +207,7 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
 // FIXME(#5121)
 fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
     do io::with_str_reader(s) |rdr| {
-        let j = result::unwrap(json::from_reader(rdr));
+        let j = json::from_reader(rdr).unwrap();
         let mut decoder = json::Decoder(j);
         Decodable::decode(&mut decoder)
     }