diff options
| author | Brian Anderson <andersrb@gmail.com> | 2011-05-22 01:41:46 -0400 |
|---|---|---|
| committer | Brian Anderson <andersrb@gmail.com> | 2011-05-22 12:28:27 -0400 |
| commit | c1122a67073f8587c7cf4d4a68fd37cdabed4298 (patch) | |
| tree | 5a841d8183194bac0a7ceca5ab3e6027742e1a26 | |
| parent | 1ecd6a82abe992f547ec40b1aed1e4c59183a10f (diff) | |
| download | rust-c1122a67073f8587c7cf4d4a68fd37cdabed4298.tar.gz rust-c1122a67073f8587c7cf4d4a68fd37cdabed4298.zip | |
stdlib: Use if/alt expressions in std::uint
| -rw-r--r-- | src/lib/uint.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/uint.rs b/src/lib/uint.rs index f4beb593cf9..044eeff4fc4 100644 --- a/src/lib/uint.rs +++ b/src/lib/uint.rs @@ -58,25 +58,25 @@ fn to_str(uint num, uint radix) -> str assert (0u < radix && radix <= 16u); fn digit(uint n) -> char { - alt (n) { - case (0u) { ret '0'; } - case (1u) { ret '1'; } - case (2u) { ret '2'; } - case (3u) { ret '3'; } - case (4u) { ret '4'; } - case (5u) { ret '5'; } - case (6u) { ret '6'; } - case (7u) { ret '7'; } - case (8u) { ret '8'; } - case (9u) { ret '9'; } - case (10u) { ret 'a'; } - case (11u) { ret 'b'; } - case (12u) { ret 'c'; } - case (13u) { ret 'd'; } - case (14u) { ret 'e'; } - case (15u) { ret 'f'; } - } - fail; + ret alt (n) { + case (0u) { '0' } + case (1u) { '1' } + case (2u) { '2' } + case (3u) { '3' } + case (4u) { '4' } + case (5u) { '5' } + case (6u) { '6' } + case (7u) { '7' } + case (8u) { '8' } + case (9u) { '9' } + case (10u) { 'a' } + case (11u) { 'b' } + case (12u) { 'c' } + case (13u) { 'd' } + case (14u) { 'e' } + case (15u) { 'f' } + case (_) { fail } + }; } if (n == 0u) { ret "0"; } |
