about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-09-21 19:37:57 -0700
committerBrian Anderson <banderson@mozilla.com>2012-09-23 17:15:00 -0700
commit4a78f9b16620489855da93c19be56f59431416f6 (patch)
tree4b164738698203f474003682d5f0a5e23aa13377 /src/libstd
parent92752a462a055d6478bd96dab37a740514992106 (diff)
downloadrust-4a78f9b16620489855da93c19be56f59431416f6.tar.gz
rust-4a78f9b16620489855da93c19be56f59431416f6.zip
core: Demode option
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/getopts.rs14
-rw-r--r--src/libstd/map.rs4
-rw-r--r--src/libstd/net_url.rs14
-rw-r--r--src/libstd/smallintmap.rs2
-rw-r--r--src/libstd/test.rs8
5 files changed, 21 insertions, 21 deletions
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index 6f827be2b8a..c8d1c6026c7 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -303,8 +303,8 @@ fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe {
                       Some(id) => last_valid_opt_id = option::Some(id),
                       None => {
                         let arg_follows =
-                            option::is_some(last_valid_opt_id) &&
-                            match opts[option::get(last_valid_opt_id)]
+                            last_valid_opt_id.is_some() &&
+                            match opts[last_valid_opt_id.get()]
                               .hasarg {
 
                               Yes | Maybe => true,
@@ -331,23 +331,23 @@ fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe {
                 };
                 match opts[optid].hasarg {
                   No => {
-                    if !option::is_none::<~str>(i_arg) {
+                    if !i_arg.is_none() {
                         return Err(UnexpectedArgument(name_str(nm)));
                     }
                     vec::push(vals[optid], Given);
                   }
                   Maybe => {
-                    if !option::is_none::<~str>(i_arg) {
-                        vec::push(vals[optid], Val(option::get(i_arg)));
+                    if !i_arg.is_none() {
+                        vec::push(vals[optid], Val(i_arg.get()));
                     } else if name_pos < vec::len::<Name>(names) ||
                                   i + 1u == l || is_arg(args[i + 1u]) {
                         vec::push(vals[optid], Given);
                     } else { i += 1u; vec::push(vals[optid], Val(args[i])); }
                   }
                   Yes => {
-                    if !option::is_none::<~str>(i_arg) {
+                    if !i_arg.is_none() {
                         vec::push(vals[optid],
-                                  Val(option::get::<~str>(i_arg)));
+                                  Val(i_arg.get()));
                     } else if i + 1u == l {
                         return Err(ArgumentMissing(name_str(nm)));
                     } else { i += 1u; vec::push(vals[optid], Val(args[i])); }
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index adaab0050bb..9bdf6e15ee5 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -730,9 +730,9 @@ mod tests {
     fn test_find() {
         let key = ~"k";
         let map = map::HashMap::<~str, ~str>();
-        assert (option::is_none(map.find(key)));
+        assert (option::is_none(&map.find(key)));
         map.insert(key, ~"val");
-        assert (option::get(map.find(key)) == ~"val");
+        assert (option::get(&map.find(key)) == ~"val");
     }
 
     #[test]
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index a824f5ab117..2545661356f 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -308,7 +308,7 @@ fn userinfo_from_str(uinfo: &str) -> UserInfo {
 }
 
 fn userinfo_to_str(+userinfo: UserInfo) -> ~str {
-    if option::is_some(userinfo.pass) {
+    if option::is_some(&userinfo.pass) {
         return str::concat(~[copy userinfo.user, ~":",
                           option::unwrap(copy userinfo.pass),
                           ~"@"]);
@@ -708,7 +708,7 @@ impl Url : FromStr {
  *
  */
 fn to_str(+url: Url) -> ~str {
-    let user = if option::is_some(url.user) {
+    let user = if url.user.is_some() {
       userinfo_to_str(option::unwrap(copy url.user))
     } else {
        ~""
@@ -723,7 +723,7 @@ fn to_str(+url: Url) -> ~str {
     } else {
         str::concat(~[~"?", query_to_str(url.query)])
     };
-    let fragment = if option::is_some(url.fragment) {
+    let fragment = if url.fragment.is_some() {
         str::concat(~[~"#", encode_component(
             option::unwrap(copy url.fragment))])
     } else {
@@ -805,21 +805,21 @@ mod tests {
         assert u == option::Some({user: ~"user",
                                   pass: option::Some(~"pass")});
         assert h == ~"rust-lang.org";
-        assert option::is_none(p);
+        assert p.is_none();
         assert r == ~"/something";
 
         let (u, h, p, r) = result::unwrap(get_authority(
             ~"//rust-lang.org:8000?something"));
-        assert option::is_none(u);
+        assert u.is_none();
         assert h == ~"rust-lang.org";
         assert p == option::Some(~"8000");
         assert r == ~"?something";
 
         let (u, h, p, r) = result::unwrap(get_authority(
             ~"//rust-lang.org#blah"));
-        assert option::is_none(u);
+        assert u.is_none();
         assert h == ~"rust-lang.org";
-        assert option::is_none(p);
+        assert p.is_none();
         assert r == ~"#blah";
 
         // ipv6 tests
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index ffa5aeef31e..8ce1ebde127 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -62,7 +62,7 @@ pure fn get<T: Copy>(self: SmallIntMap<T>, key: uint) -> T {
 
 /// Returns true if the map contains a value for the specified key
 fn contains_key<T: Copy>(self: SmallIntMap<T>, key: uint) -> bool {
-    return !option::is_none(find(self, key));
+    return !find(self, key).is_none();
 }
 
 /// Implements the map::map interface for smallintmap
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index d01991bfec1..a4af0a1772f 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -274,8 +274,8 @@ fn should_sort_failures_before_printing_them() {
         print_failures(st);
     };
 
-    let apos = option::get(str::find_str(s, ~"a"));
-    let bpos = option::get(str::find_str(s, ~"b"));
+    let apos = str::find_str(s, ~"a").get();
+    let bpos = str::find_str(s, ~"b").get();
     assert apos < bpos;
 }
 
@@ -351,7 +351,7 @@ fn filter_tests(opts: &TestOpts,
     let mut filtered = vec::slice(tests, 0, tests.len());
 
     // Remove tests that don't match the test filter
-    filtered = if option::is_none(opts.filter) {
+    filtered = if opts.filter.is_none() {
         move filtered
     } else {
         let filter_str =
@@ -503,7 +503,7 @@ mod tests {
           either::Left(o) => o,
           _ => fail ~"Malformed arg in first_free_arg_should_be_a_filter"
         };
-        assert ~"filter" == option::get(opts.filter);
+        assert ~"filter" == opts.filter.get();
     }
 
     #[test]