Skip to content

Commit 616398b

Browse files
committed
---
yaml --- r: 34415 b: refs/heads/snap-stage3 c: 51b141e h: refs/heads/master i: 34413: b77a4bc 34411: 71623c8 34407: 9c68e4a 34399: 291c139 v: v3
1 parent e403a78 commit 616398b

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0a17ab2a9cb4a9c1ce34da670127e45c70e2b99f
4+
refs/heads/snap-stage3: 51b141e3e499558ddfece1f00dd6714f442c2404
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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)