diff options
| author | Eric Holk <eric.holk@gmail.com> | 2012-07-24 12:11:29 -0700 |
|---|---|---|
| committer | Eric Holk <eric.holk@gmail.com> | 2012-07-25 12:12:25 -0700 |
| commit | 7ecddb2771922bcd0f117a3a3f681da9bcb8b70c (patch) | |
| tree | b801d3c113a7b783fcbef7e9a508cc31bf47e7ea /src/libcore/extfmt.rs | |
| parent | f5be06fa1fed6d9f9467bc644e78292bf94b30f4 (diff) | |
More purity to make it easier to borrow strings in format strings.
Diffstat (limited to 'src/libcore/extfmt.rs')
| -rw-r--r-- | src/libcore/extfmt.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index eabaffc8995..ec5e9602e19 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -312,7 +312,7 @@ mod rt { let mut s = str::from_char(c); ret pad(cv, s, pad_nozero); } - fn conv_str(cv: conv, s: &str) -> ~str { + pure fn conv_str(cv: conv, s: &str) -> ~str { // For strings, precision is the maximum characters // displayed let mut unpadded = alt cv.precision { @@ -323,7 +323,7 @@ mod rt { } else { s.to_unique() } } }; - ret pad(cv, unpadded, pad_nozero); + ret unchecked { pad(cv, unpadded, pad_nozero) }; } fn conv_float(cv: conv, f: float) -> ~str { let (to_str, digits) = alt cv.precision { @@ -398,7 +398,7 @@ mod rt { pad_float { {might_zero_pad:true, signed:true } } pad_unsigned { {might_zero_pad:true, signed:false} } }; - fn have_precision(cv: conv) -> bool { + pure fn have_precision(cv: conv) -> bool { ret alt cv.precision { count_implied { false } _ { true } }; } let zero_padding = { @@ -428,7 +428,7 @@ mod rt { } ret padstr + s; } - fn have_flag(flags: u32, f: u32) -> bool { + pure fn have_flag(flags: u32, f: u32) -> bool { flags & f != 0 } } |
