@@ -483,12 +483,12 @@ pub mod rt {
483
483
use vec;
484
484
use option::{Some, None, Option};
485
485
486
- pub const flag_none : u32 = 0u32;
487
- pub const flag_left_justify : u32 = 0b00000000000001u32;
488
- pub const flag_left_zero_pad : u32 = 0b00000000000010u32;
489
- pub const flag_space_for_sign : u32 = 0b00000000000100u32;
490
- pub const flag_sign_always : u32 = 0b00000000001000u32;
491
- pub const flag_alternate : u32 = 0b00000000010000u32;
486
+ pub static flag_none : u32 = 0u32;
487
+ pub static flag_left_justify : u32 = 0b00000000000001u32;
488
+ pub static flag_left_zero_pad : u32 = 0b00000000000010u32;
489
+ pub static flag_space_for_sign : u32 = 0b00000000000100u32;
490
+ pub static flag_sign_always : u32 = 0b00000000001000u32;
491
+ pub static flag_alternate : u32 = 0b00000000010000u32;
492
492
493
493
pub enum Count { CountIs(uint), CountImplied, }
494
494
@@ -501,7 +501,7 @@ pub mod rt {
501
501
ty: Ty,
502
502
}
503
503
504
- pub pure fn conv_int(cv: Conv, i: int, buf: &mut ~str) {
504
+ pub fn conv_int(cv: Conv, i: int, buf: &mut ~str) {
505
505
let radix = 10;
506
506
let prec = get_int_precision(cv);
507
507
let mut s : ~str = uint_to_str_prec(int::abs(i) as uint, radix, prec);
@@ -517,7 +517,7 @@ pub mod rt {
517
517
} else { Some('-') };
518
518
unsafe { pad(cv, s, head, PadSigned, buf) };
519
519
}
520
- pub pure fn conv_uint(cv: Conv, u: uint, buf: &mut ~str) {
520
+ pub fn conv_uint(cv: Conv, u: uint, buf: &mut ~str) {
521
521
let prec = get_int_precision(cv);
522
522
let mut rs =
523
523
match cv.ty {
@@ -529,16 +529,16 @@ pub mod rt {
529
529
};
530
530
unsafe { pad(cv, rs, None, PadUnsigned, buf) };
531
531
}
532
- pub pure fn conv_bool(cv: Conv, b: bool, buf: &mut ~str) {
532
+ pub fn conv_bool(cv: Conv, b: bool, buf: &mut ~str) {
533
533
let s = if b { " true " } else { " false " };
534
534
// run the boolean conversion through the string conversion logic,
535
535
// giving it the same rules for precision, etc.
536
536
conv_str(cv, s, buf);
537
537
}
538
- pub pure fn conv_char(cv: Conv, c: char, buf: &mut ~str) {
538
+ pub fn conv_char(cv: Conv, c: char, buf: &mut ~str) {
539
539
unsafe { pad(cv, " ", Some(c), PadNozero, buf) };
540
540
}
541
- pub pure fn conv_str(cv: Conv, s: &str, buf: &mut ~str) {
541
+ pub fn conv_str(cv: Conv, s: &str, buf: &mut ~str) {
542
542
// For strings, precision is the maximum characters
543
543
// displayed
544
544
let mut unpadded = match cv.precision {
@@ -551,7 +551,7 @@ pub mod rt {
551
551
};
552
552
unsafe { pad(cv, unpadded, None, PadNozero, buf) };
553
553
}
554
- pub pure fn conv_float(cv: Conv, f: float, buf: &mut ~str) {
554
+ pub fn conv_float(cv: Conv, f: float, buf: &mut ~str) {
555
555
let (to_str, digits) = match cv.precision {
556
556
CountIs(c) => (float::to_str_exact, c as uint),
557
557
CountImplied => (float::to_str_digits, 6u)
@@ -568,16 +568,15 @@ pub mod rt {
568
568
} else { None };
569
569
unsafe { pad(cv, s, head, PadFloat, buf) };
570
570
}
571
- pub pure fn conv_poly<T>(cv: Conv, v: &T, buf: &mut ~str) {
571
+ pub fn conv_poly<T>(cv: Conv, v: &T, buf: &mut ~str) {
572
572
let s = sys::log_str(v);
573
573
conv_str(cv, s, buf);
574
574
}
575
575
576
576
// Convert a uint to string with a minimum number of digits. If precision
577
577
// is 0 and num is 0 then the result is the empty string. Could move this
578
578
// to uint: but it doesn't seem all that useful.
579
- pub pure fn uint_to_str_prec(num: uint, radix: uint,
580
- prec: uint) -> ~str {
579
+ pub fn uint_to_str_prec(num: uint, radix: uint, prec: uint) -> ~str {
581
580
return if prec == 0u && num == 0u {
582
581
~" "
583
582
} else {
@@ -590,7 +589,7 @@ pub mod rt {
590
589
} else { s }
591
590
};
592
591
}
593
- pub pure fn get_int_precision(cv: Conv) -> uint {
592
+ pub fn get_int_precision(cv: Conv) -> uint {
594
593
return match cv.precision {
595
594
CountIs(c) => c as uint,
596
595
CountImplied => 1u
@@ -637,7 +636,7 @@ pub mod rt {
637
636
PadFloat => (true, true),
638
637
PadUnsigned => (true, false)
639
638
};
640
- pure fn have_precision(cv: Conv) -> bool {
639
+ fn have_precision(cv: Conv) -> bool {
641
640
return match cv.precision { CountImplied => false, _ => true };
642
641
}
643
642
let zero_padding = {
@@ -672,7 +671,7 @@ pub mod rt {
672
671
buf.push_str(s);
673
672
}
674
673
#[inline(always)]
675
- pub pure fn have_flag(flags: u32, f: u32) -> bool {
674
+ pub fn have_flag(flags: u32, f: u32) -> bool {
676
675
flags & f != 0
677
676
}
678
677
}
0 commit comments