Skip to content

Commit cb5fed8

Browse files
committed
---
yaml --- r: 52129 b: refs/heads/dist-snap c: 51b141e h: refs/heads/master i: 52127: b8c9d96 v: v3
1 parent 7119882 commit cb5fed8

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 0a17ab2a9cb4a9c1ce34da670127e45c70e2b99f
10+
refs/heads/dist-snap: 51b141e3e499558ddfece1f00dd6714f442c2404
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/extfmt.rs

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -310,34 +310,23 @@ pub mod ct {
310310
pub fn parse_type(s: &str, i: uint, lim: uint, err: ErrorFn) ->
311311
Parsed<Ty> {
312312
if i >= lim { err(~"missing type in conversion"); }
313-
let tstr = str::slice(s, i, i+1u);
314313
// FIXME (#2249): Do we really want two signed types here?
315314
// How important is it to be printf compatible?
316-
let t =
317-
if tstr == ~"b" {
318-
TyBool
319-
} else if tstr == ~"s" {
320-
TyStr
321-
} else if tstr == ~"c" {
322-
TyChar
323-
} else if tstr == ~"d" || tstr == ~"i" {
324-
TyInt(Signed)
325-
} else if tstr == ~"u" {
326-
TyInt(Unsigned)
327-
} else if tstr == ~"x" {
328-
TyHex(CaseLower)
329-
} else if tstr == ~"X" {
330-
TyHex(CaseUpper)
331-
} else if tstr == ~"t" {
332-
TyBits
333-
} else if tstr == ~"o" {
334-
TyOctal
335-
} else if tstr == ~"f" {
336-
TyFloat
337-
} else if tstr == ~"?" {
338-
TyPoly
339-
} else { err(~"unknown type in conversion: " + tstr) };
340-
return Parsed::new(t, i + 1u);
315+
let t = match s[i] {
316+
'b' as u8 => TyBool,
317+
's' as u8 => TyStr,
318+
'c' as u8 => TyChar,
319+
'd' as u8 | 'i' as u8 => TyInt(Signed),
320+
'u' as u8 => TyInt(Unsigned),
321+
'x' as u8 => TyHex(CaseLower),
322+
'X' as u8 => TyHex(CaseUpper),
323+
't' as u8 => TyBits,
324+
'o' as u8 => TyOctal,
325+
'f' as u8 => TyFloat,
326+
'?' as u8 => TyPoly,
327+
_ => err(~"unknown type in conversion: " + s.substr(i, 1))
328+
};
329+
Parsed::new(t, i + 1)
341330
}
342331
}
343332

0 commit comments

Comments
 (0)