@@ -270,7 +270,10 @@ mod ct {
270
270
}
271
271
}
272
272
273
- // OLD CODE -- eventually remove
273
+ // Functions used by the fmt extension at runtime. For now there are a lot of
274
+ // decisions made a runtime. If it proves worthwhile then some of these
275
+ // conditions can be evaluated at compile-time. For now though it's cleaner to
276
+ // implement it 0this way, I think.
274
277
mod rt {
275
278
#[legacy_exports];
276
279
const flag_none : u32 = 0u32;
@@ -286,7 +289,7 @@ mod rt {
286
289
type Conv = {flags: u32, width: Count, precision: Count, ty: Ty};
287
290
288
291
pure fn conv_int(cv: Conv, i: int) -> ~str {
289
- let radix = 10u ;
292
+ let radix = 10 ;
290
293
let prec = get_int_precision(cv);
291
294
let mut s : ~str = int_to_str_prec(i, radix, prec);
292
295
if 0 <= i {
@@ -320,13 +323,13 @@ mod rt {
320
323
let mut s = str:: from_char ( c) ;
321
324
return unsafe { pad ( cv, s, PadNozero ) } ;
322
325
}
323
- pure fn conv_str ( cv : Conv , s : & str ) -> ~str {
326
+ pure fn conv_str ( cv : Conv , + s : & str ) -> ~str {
324
327
// For strings, precision is the maximum characters
325
328
// displayed
326
329
let mut unpadded = match cv. precision {
327
330
CountImplied => s. to_unique ( ) ,
328
331
CountIs ( max) => if max as uint < str:: char_len ( s ) {
329
- str:: substr ( s, 0 , max as uint )
332
+ str:: substr ( s, 0 u , max as uint )
330
333
} else {
331
334
s. to_unique ( )
332
335
}
@@ -336,7 +339,7 @@ mod rt {
336
339
pure fn conv_float ( cv : Conv , f : float ) -> ~str {
337
340
let ( to_str, digits) = match cv. precision {
338
341
CountIs ( c) => ( float:: to_str_exact, c as uint ) ,
339
- CountImplied => ( float:: to_str, 6 )
342
+ CountImplied => ( float:: to_str, 6 u )
340
343
} ;
341
344
let mut s = unsafe { to_str ( f, digits) } ;
342
345
if 0.0 <= f {
@@ -348,8 +351,8 @@ mod rt {
348
351
}
349
352
return unsafe { pad(cv, s, PadFloat) };
350
353
}
351
- pure fn conv_poly<T>(cv: Conv, v: T) -> ~str {
352
- let s = sys::log_str(& v);
354
+ pure fn conv_poly<T>(cv: Conv, v: & T) -> ~str {
355
+ let s = sys::log_str(v);
353
356
return conv_str(cv, s);
354
357
}
355
358
@@ -460,7 +463,7 @@ mod rt {
460
463
}
461
464
}
462
465
463
- // NEW CODE
466
+ // Remove after snapshot
464
467
465
468
// Functions used by the fmt extension at runtime. For now there are a lot of
466
469
// decisions made a runtime. If it proves worthwhile then some of these
0 commit comments