about summary refs log tree commit diff
path: root/src/libcore/float.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-06 12:34:08 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-06 15:36:30 -0700
commitecaf9e39c9435fa2de4fe393c4b263be36eb2d99 (patch)
tree775f69be65adff65551d96173dd797e32e2c3157 /src/libcore/float.rs
parentd3a9bb1bd4a1d510bbaca2ab1121e4c85a239247 (diff)
downloadrust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.tar.gz
rust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.zip
Convert alt to match. Stop parsing alt
Diffstat (limited to 'src/libcore/float.rs')
-rw-r--r--src/libcore/float.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index 02133205be9..4269ef41f4d 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -256,14 +256,14 @@ fn from_str(num: ~str) -> option<float> {
    let mut c     = 'z';            //Latest char.
 
    //The string must start with one of the following characters.
-   alt str::char_at(num, 0u) {
+   match str::char_at(num, 0u) {
       '-' | '+' | '0' to '9' | '.' => (),
       _ => return none
    }
 
    //Determine if first char is '-'/'+'. Set [pos] and [neg] accordingly.
    let mut neg = false;               //Sign of the result
-   alt str::char_at(num, 0u) {
+   match str::char_at(num, 0u) {
       '-' => {
           neg = true;
           pos = 1u;
@@ -279,7 +279,7 @@ fn from_str(num: ~str) -> option<float> {
        let char_range = str::char_range_at(num, pos);
        c   = char_range.ch;
        pos = char_range.next;
-       alt c {
+       match c {
          '0' to '9' => {
            total = total * 10f;
            total += ((c as int) - ('0' as int)) as float;
@@ -295,7 +295,7 @@ fn from_str(num: ~str) -> option<float> {
          let char_range = str::char_range_at(num, pos);
          c = char_range.ch;
          pos = char_range.next;
-         alt c {
+         match c {
             '0' | '1' | '2' | '3' | '4' | '5' | '6'| '7' | '8' | '9'  => {
                  decimal /= 10f;
                  total += (((c as int) - ('0' as int)) as float)*decimal;
@@ -312,7 +312,7 @@ fn from_str(num: ~str) -> option<float> {
       if(pos < len) {
           let char_range = str::char_range_at(num, pos);
           c   = char_range.ch;
-          alt c  {
+          match c  {
              '+' => {
                 pos = char_range.next;
              }
@@ -325,7 +325,7 @@ fn from_str(num: ~str) -> option<float> {
           while(pos < len) {
              let char_range = str::char_range_at(num, pos);
              c = char_range.ch;
-             alt c {
+             match c {
                  '0' | '1' | '2' | '3' | '4' | '5' | '6'| '7' | '8' | '9' => {
                      exponent *= 10u;
                      exponent += ((c as uint) - ('0' as uint));
@@ -447,7 +447,7 @@ fn test_from_str() {
    assert from_str(~"inf") == some(infinity);
    assert from_str(~"-inf") == some(neg_infinity);
    // note: NaN != NaN, hence this slightly complex test
-   alt from_str(~"NaN") {
+   match from_str(~"NaN") {
        some(f) => assert is_NaN(f),
        none => fail
    }