Skip to content

Commit c1122a6

Browse files
committed
stdlib: Use if/alt expressions in std::uint
1 parent 1ecd6a8 commit c1122a6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/lib/uint.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ fn to_str(uint num, uint radix) -> str
5858

5959
assert (0u < radix && radix <= 16u);
6060
fn digit(uint n) -> char {
61-
alt (n) {
62-
case (0u) { ret '0'; }
63-
case (1u) { ret '1'; }
64-
case (2u) { ret '2'; }
65-
case (3u) { ret '3'; }
66-
case (4u) { ret '4'; }
67-
case (5u) { ret '5'; }
68-
case (6u) { ret '6'; }
69-
case (7u) { ret '7'; }
70-
case (8u) { ret '8'; }
71-
case (9u) { ret '9'; }
72-
case (10u) { ret 'a'; }
73-
case (11u) { ret 'b'; }
74-
case (12u) { ret 'c'; }
75-
case (13u) { ret 'd'; }
76-
case (14u) { ret 'e'; }
77-
case (15u) { ret 'f'; }
78-
}
79-
fail;
61+
ret alt (n) {
62+
case (0u) { '0' }
63+
case (1u) { '1' }
64+
case (2u) { '2' }
65+
case (3u) { '3' }
66+
case (4u) { '4' }
67+
case (5u) { '5' }
68+
case (6u) { '6' }
69+
case (7u) { '7' }
70+
case (8u) { '8' }
71+
case (9u) { '9' }
72+
case (10u) { 'a' }
73+
case (11u) { 'b' }
74+
case (12u) { 'c' }
75+
case (13u) { 'd' }
76+
case (14u) { 'e' }
77+
case (15u) { 'f' }
78+
case (_) { fail }
79+
};
8080
}
8181

8282
if (n == 0u) { ret "0"; }

0 commit comments

Comments
 (0)