auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger

The 0.8 release was cut, down with printf!
This commit is contained in:
bors 2013-09-27 08:21:23 -07:00
commit 10e7f12daf
81 changed files with 169 additions and 193 deletions

View File

@ -68,7 +68,7 @@ impl<'self> ToBase64 for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_base64(standard);
* printfln!("%s", str);
* println!("{}", str);
* }
* ```
*/
@ -177,11 +177,11 @@ impl<'self> FromBase64 for &'self str {
*
* fn main () {
* let hello_str = "Hello, World".to_base64(standard);
* printfln!("%s", hello_str);
* println!("{}", hello_str);
* let bytes = hello_str.from_base64();
* printfln!("%?", bytes);
* println!("{:?}", bytes);
* let result_str = str::from_utf8(bytes);
* printfln!("%s", result_str);
* println!("{}", result_str);
* }
* ```
*/

View File

@ -19,7 +19,7 @@
* # fn make_a_sandwich() {};
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
* make_a_sandwich();
* printfln!("fib(5000) = %?", delayed_fib.get())
* println!("fib(5000) = {}", delayed_fib.get())
* ```
*/

View File

@ -43,7 +43,7 @@
//! }
//!
//! fn print_usage(program: &str, _opts: &[Opt]) {
//! printfln!("Usage: %s [options]", program);
//! println!("Usage: {} [options]", program);
//! println("-o\t\tOutput");
//! println("-h --help\tUsage");
//! }

View File

@ -33,7 +33,7 @@ impl<'self> ToHex for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_hex();
* printfln!("%s", str);
* println!("{}", str);
* }
* ```
*/
@ -77,11 +77,11 @@ impl<'self> FromHex for &'self str {
*
* fn main () {
* let hello_str = "Hello, World".to_hex();
* printfln!("%s", hello_str);
* println!("{}", hello_str);
* let bytes = hello_str.from_hex().unwrap();
* printfln!("%?", bytes);
* println!("{:?}", bytes);
* let result_str = str::from_utf8(bytes);
* printfln!("%s", result_str);
* println!("{}", result_str);
* }
* ```
*/

View File

@ -103,6 +103,6 @@ fn test_task_pool() {
};
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
do 8.times {
pool.execute(|i| printfln!("Hello from thread %u!", *i));
pool.execute(|i| println!("Hello from thread {}!", *i));
}
}

View File

@ -136,13 +136,13 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
match find_cmd(command_string) {
Some(command) => {
match command.action {
CallMain(prog, _) => printfln!(
"The %s command is an alias for the %s program.",
CallMain(prog, _) => println!(
"The {} command is an alias for the {} program.",
command.cmd, prog),
_ => ()
}
match command.usage_full {
UsgStr(msg) => printfln!("%s\n", msg),
UsgStr(msg) => println!("{}\n", msg),
UsgCall(f) => f(),
}
Valid(0)
@ -215,7 +215,7 @@ fn usage() {
for command in COMMANDS.iter() {
let padding = " ".repeat(INDENT - command.cmd.len());
printfln!(" %s%s%s", command.cmd, padding, command.usage_line);
println!(" {}{}{}", command.cmd, padding, command.usage_line);
}
io::print(

View File

@ -1822,17 +1822,17 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
}
io::println("metadata stats:");
printfln!(" inline bytes: %u", ecx.stats.inline_bytes);
printfln!(" attribute bytes: %u", ecx.stats.attr_bytes);
printfln!(" dep bytes: %u", ecx.stats.dep_bytes);
printfln!(" lang item bytes: %u", ecx.stats.lang_item_bytes);
printfln!(" link args bytes: %u", ecx.stats.link_args_bytes);
printfln!(" impl bytes: %u", ecx.stats.impl_bytes);
printfln!(" misc bytes: %u", ecx.stats.misc_bytes);
printfln!(" item bytes: %u", ecx.stats.item_bytes);
printfln!(" index bytes: %u", ecx.stats.index_bytes);
printfln!(" zero bytes: %u", ecx.stats.zero_bytes);
printfln!(" total bytes: %u", ecx.stats.total_bytes);
println!(" inline bytes: {}", ecx.stats.inline_bytes);
println!(" attribute bytes: {}", ecx.stats.attr_bytes);
println!(" dep bytes: {}", ecx.stats.dep_bytes);
println!(" lang item bytes: {}", ecx.stats.lang_item_bytes);
println!(" link args bytes: {}", ecx.stats.link_args_bytes);
println!(" impl bytes: {}", ecx.stats.impl_bytes);
println!(" misc bytes: {}", ecx.stats.misc_bytes);
println!(" item bytes: {}", ecx.stats.item_bytes);
println!(" index bytes: {}", ecx.stats.index_bytes);
println!(" zero bytes: {}", ecx.stats.zero_bytes);
println!(" total bytes: {}", ecx.stats.total_bytes);
}
// Pad this, since something (LLVM, presumably) is cutting off the

View File

@ -100,16 +100,16 @@ pub fn check_crate(
if tcx.sess.borrowck_stats() {
io::println("--- borrowck stats ---");
printfln!("paths requiring guarantees: %u",
bccx.stats.guaranteed_paths);
printfln!("paths requiring loans : %s",
make_stat(bccx, bccx.stats.loaned_paths_same));
printfln!("paths requiring imm loans : %s",
make_stat(bccx, bccx.stats.loaned_paths_imm));
printfln!("stable paths : %s",
make_stat(bccx, bccx.stats.stable_paths));
printfln!("paths requiring purity : %s",
make_stat(bccx, bccx.stats.req_pure_paths));
println!("paths requiring guarantees: {}",
bccx.stats.guaranteed_paths);
println!("paths requiring loans : {}",
make_stat(bccx, bccx.stats.loaned_paths_same));
println!("paths requiring imm loans : {}",
make_stat(bccx, bccx.stats.loaned_paths_imm));
println!("stable paths : {}",
make_stat(bccx, bccx.stats.stable_paths));
println!("paths requiring purity : {}",
make_stat(bccx, bccx.stats.req_pure_paths));
}
return (bccx.root_map, bccx.write_guard_map);

View File

@ -121,7 +121,7 @@ impl Drop for _InsnCtxt {
}
pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
debug!("new InsnCtxt: %s", s);
debug2!("new InsnCtxt: {}", s);
do local_data::modify(task_local_insn_key) |c| {
do c.map_move |ctx| {
let mut ctx = (*ctx).clone();
@ -3147,15 +3147,15 @@ pub fn trans_crate(sess: session::Session,
write_metadata(ccx, crate);
if ccx.sess.trans_stats() {
io::println("--- trans stats ---");
printfln!("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
printfln!("n_glues_created: %u", ccx.stats.n_glues_created);
printfln!("n_null_glues: %u", ccx.stats.n_null_glues);
printfln!("n_real_glues: %u", ccx.stats.n_real_glues);
println!("n_static_tydescs: {}", ccx.stats.n_static_tydescs);
println!("n_glues_created: {}", ccx.stats.n_glues_created);
println!("n_null_glues: {}", ccx.stats.n_null_glues);
println!("n_real_glues: {}", ccx.stats.n_real_glues);
printfln!("n_fns: %u", ccx.stats.n_fns);
printfln!("n_monos: %u", ccx.stats.n_monos);
printfln!("n_inlines: %u", ccx.stats.n_inlines);
printfln!("n_closures: %u", ccx.stats.n_closures);
println!("n_fns: {}", ccx.stats.n_fns);
println!("n_monos: {}", ccx.stats.n_monos);
println!("n_inlines: {}", ccx.stats.n_inlines);
println!("n_closures: {}", ccx.stats.n_closures);
io::println("fn stats:");
do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| {
insns_a > insns_b
@ -3163,14 +3163,14 @@ pub fn trans_crate(sess: session::Session,
for tuple in ccx.stats.fn_stats.iter() {
match *tuple {
(ref name, ms, insns) => {
printfln!("%u insns, %u ms, %s", insns, ms, *name);
println!("{} insns, {} ms, {}", insns, ms, *name);
}
}
}
}
if ccx.sess.count_llvm_insns() {
for (k, v) in ccx.stats.llvm_insns.iter() {
printfln!("%-7u %s", *v, *k);
println!("{:7u} {}", *v, *k);
}
}

View File

@ -646,8 +646,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
let llty = type_of(ccx, t);
if ccx.sess.count_type_sizes() {
printfln!("%u\t%s", llsize_of_real(ccx, llty),
ppaux::ty_to_str(ccx.tcx, t));
println!("{}\t{}", llsize_of_real(ccx, llty),
ppaux::ty_to_str(ccx.tcx, t));
}
let has_header = match ty::get(t).sty {

View File

@ -130,13 +130,13 @@ pub fn version(argv0: &str) {
Some(vers) => vers,
None => "unknown version"
};
printfln!("%s %s", argv0, vers);
printfln!("host: %s", host_triple());
println!("{} {}", argv0, vers);
println!("host: {}", host_triple());
}
pub fn usage(argv0: &str) {
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
printfln!("%s\n\
println!("{}\n\
Additional help:
-W help Print 'lint' options and default settings
-Z help Print internal options for debugging rustc\n",
@ -167,16 +167,16 @@ Available lint options:
str::from_utf8(vec::from_elem(max - s.len(), ' ' as u8)) + s
}
println("\nAvailable lint checks:\n");
printfln!(" %s %7.7s %s",
padded(max_key, "name"), "default", "meaning");
printfln!(" %s %7.7s %s\n",
padded(max_key, "----"), "-------", "-------");
println!(" {} {:7.7s} {}",
padded(max_key, "name"), "default", "meaning");
println!(" {} {:7.7s} {}\n",
padded(max_key, "----"), "-------", "-------");
for (spec, name) in lint_dict.move_iter() {
let name = name.replace("_", "-");
printfln!(" %s %7.7s %s",
padded(max_key, name),
lint::level_to_str(spec.default),
spec.desc);
println!(" {} {:7.7s} {}",
padded(max_key, name),
lint::level_to_str(spec.default),
spec.desc);
}
io::println("");
}
@ -187,7 +187,7 @@ pub fn describe_debug_flags() {
for tuple in r.iter() {
match *tuple {
(ref name, ref desc, _) => {
printfln!(" -Z %-20s -- %s", *name, *desc);
println!(" -Z {:>20s} -- {}", *name, *desc);
}
}
}

View File

@ -22,7 +22,7 @@ pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
let start = extra::time::precise_time_s();
let rv = thunk();
let end = extra::time::precise_time_s();
printfln!("time: %3.3f s\t%s", end - start, what);
println!("time: {:3.3f} s\t{}", end - start, what);
rv
}

View File

@ -437,7 +437,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
if loaded_crates.is_empty() {
println("no crates loaded");
} else {
printfln!("crates loaded: %s", loaded_crates.connect(", "));
println!("crates loaded: {}", loaded_crates.connect(", "));
}
}
~"{" => {

View File

@ -34,7 +34,7 @@ pub fn main() {
}
if args[2] != ~"install" {
printfln!("Warning: I don't know how to %s", args[2]);
println!("Warning: I don't know how to {}", args[2]);
return;
}

View File

@ -413,7 +413,7 @@ pub trait Iterator<A> {
/// use std::iter::count;
///
/// for i in count(0, 10) {
/// printfln!("%d", i);
/// println!("{}", i);
/// }
/// ```
#[inline]

View File

@ -70,7 +70,7 @@ fn ziggurat<R:Rng>(rng: &mut R,
///
/// fn main() {
/// let normal = 2.0 + (*rand::random::<StandardNormal>()) * 3.0;
/// printfln!("%f is from a N(2, 9) distribution", normal)
/// println!("{} is from a N(2, 9) distribution", normal)
/// }
/// ```
pub struct StandardNormal(f64);
@ -124,7 +124,7 @@ impl Rand for StandardNormal {
///
/// fn main() {
/// let exp2 = (*rand::random::<Exp1>()) * 0.5;
/// printfln!("%f is from a Exp(2) distribution", exp2);
/// println!("{} is from a Exp(2) distribution", exp2);
/// }
/// ```
pub struct Exp1(f64);

View File

@ -28,7 +28,7 @@ use std::rand::Rng;
fn main() {
let mut rng = rand::rng();
if rng.gen() { // bool
printfln!("int: %d, uint: %u", rng.gen(), rng.gen())
println!("int: {}, uint: {}", rng.gen::<int>(), rng.gen::<uint>())
}
}
```
@ -38,7 +38,7 @@ use std::rand;
fn main () {
let tuple_ptr = rand::random::<~(f64, char)>();
printfln!(tuple_ptr)
println!(tuple_ptr)
}
```
*/
@ -270,8 +270,8 @@ pub trait Rng {
/// fn main() {
/// let rng = rand::task_rng();
/// let x: uint = rng.gen();
/// printfln!(x);
/// printfln!(rng.gen::<(float, bool)>());
/// println!("{}", x);
/// println!("{:?}", rng.gen::<(float, bool)>());
/// }
/// ```
#[inline(always)]
@ -289,8 +289,8 @@ pub trait Rng {
/// fn main() {
/// let rng = rand::task_rng();
/// let x: ~[uint] = rng.gen_vec(10);
/// printfln!(x);
/// printfln!(rng.gen_vec::<(float, bool)>(5));
/// println!("{:?}", x);
/// println!("{:?}", rng.gen_vec::<(float, bool)>(5));
/// }
/// ```
fn gen_vec<T: Rand>(&mut self, len: uint) -> ~[T] {
@ -314,9 +314,9 @@ pub trait Rng {
/// fn main() {
/// let rng = rand::task_rng();
/// let n: uint = rng.gen_integer_range(0u, 10);
/// printfln!(n);
/// println!("{}", n);
/// let m: i16 = rng.gen_integer_range(-40, 400);
/// printfln!(m);
/// println!("{}", m);
/// }
/// ```
fn gen_integer_range<T: Rand + Int>(&mut self, low: T, high: T) -> T {
@ -341,7 +341,7 @@ pub trait Rng {
///
/// fn main() {
/// let mut rng = rand::rng();
/// printfln!("%b", rng.gen_weighted_bool(3));
/// println!("{:b}", rng.gen_weighted_bool(3));
/// }
/// ```
fn gen_weighted_bool(&mut self, n: uint) -> bool {
@ -385,8 +385,8 @@ pub trait Rng {
/// use std::rand;
///
/// fn main() {
/// printfln!(rand::task_rng().choose_option([1,2,4,8,16,32]));
/// printfln!(rand::task_rng().choose_option([]));
/// println!("{:?}", rand::task_rng().choose_option([1,2,4,8,16,32]));
/// println!("{:?}", rand::task_rng().choose_option([]));
/// }
/// ```
fn choose_option<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
@ -411,7 +411,7 @@ pub trait Rng {
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// printfln!("%c", rng.choose_weighted(x));
/// println!("{}", rng.choose_weighted(x));
/// }
/// ```
fn choose_weighted<T:Clone>(&mut self, v: &[Weighted<T>]) -> T {
@ -432,7 +432,7 @@ pub trait Rng {
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// printfln!(rng.choose_weighted_option(x));
/// println!("{:?}", rng.choose_weighted_option(x));
/// }
/// ```
fn choose_weighted_option<T:Clone>(&mut self, v: &[Weighted<T>])
@ -469,7 +469,7 @@ pub trait Rng {
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// printfln!(rng.weighted_vec(x));
/// println!("{}", rng.weighted_vec(x));
/// }
/// ```
fn weighted_vec<T:Clone>(&mut self, v: &[Weighted<T>]) -> ~[T] {
@ -490,7 +490,7 @@ pub trait Rng {
/// use std::rand;
///
/// fn main() {
/// printfln!(rand::task_rng().shuffle(~[1,2,3]));
/// println!("{:?}", rand::task_rng().shuffle(~[1,2,3]));
/// }
/// ```
fn shuffle<T>(&mut self, values: ~[T]) -> ~[T] {
@ -510,9 +510,9 @@ pub trait Rng {
/// let rng = rand::task_rng();
/// let mut y = [1,2,3];
/// rng.shuffle_mut(y);
/// printfln!(y);
/// println!("{:?}", y);
/// rng.shuffle_mut(y);
/// printfln!(y);
/// println!("{:?}", y);
/// }
/// ```
fn shuffle_mut<T>(&mut self, values: &mut [T]) {
@ -535,7 +535,7 @@ pub trait Rng {
/// fn main() {
/// let rng = rand::task_rng();
/// let sample = rng.sample(range(1, 100), 5);
/// printfln!(sample);
/// println!("{:?}", sample);
/// }
/// ```
fn sample<A, T: Iterator<A>>(&mut self, iter: T, n: uint) -> ~[A] {

View File

@ -1695,7 +1695,7 @@ pub trait StrSlice<'self> {
/// let i = 0u;
/// while i < s.len() {
/// let CharRange {ch, next} = s.char_range_at(i);
/// printfln!("%u: %c", i, ch);
/// println!("{}: {}", i, ch);
/// i = next;
/// }
/// ```

View File

@ -1003,7 +1003,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
* ```rust
* let v = &[1,2,3,4];
* for win in v.window_iter() {
* printfln!(win);
* println!("{:?}", win);
* }
* ```
*
@ -1032,7 +1032,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
* ```rust
* let v = &[1,2,3,4,5];
* for win in v.chunk_iter() {
* printfln!(win);
* println!("{:?}", win);
* }
* ```
*

View File

@ -1012,26 +1012,6 @@ pub fn std_macros() -> @str {
}
)
// NOTE(acrichto): start removing this after the next snapshot
macro_rules! printf (
($arg:expr) => (
print(fmt!(\"%?\", $arg))
);
($( $arg:expr ),+) => (
print(fmt!($($arg),+))
)
)
// NOTE(acrichto): start removing this after the next snapshot
macro_rules! printfln (
($arg:expr) => (
println(fmt!(\"%?\", $arg))
);
($( $arg:expr ),+) => (
println(fmt!($($arg),+))
)
)
macro_rules! format(($($arg:tt)*) => (
format_args!(::std::fmt::format, $($arg)*)
))

View File

@ -66,7 +66,7 @@ fn generic_extension(cx: @ExtCtxt,
rhses: &[@named_match])
-> MacResult {
if cx.trace_macros() {
printfln!("%s! { %s }",
println!("{}! \\{ {} \\}",
cx.str_of(name),
print::pprust::tt_to_str(
&ast::tt_delim(@mut arg.to_owned()),
@ -194,7 +194,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
rhses: &[@named_match])
-> MacResult {
if cx.trace_macros() {
printfln!("%s! { %s }",
println!("{}! \\{ {} \\}",
cx.str_of(name),
print::pprust::tt_to_str(
&ast::tt_delim(@mut arg.to_owned()),

View File

@ -24,7 +24,7 @@ fn timed(label: &str, f: &fn()) {
let start = time::precise_time_s();
f();
let end = time::precise_time_s();
printfln!(" %s: %f", label, end - start);
println!(" {}: {}", label, end - start);
}
fn ascending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
@ -116,7 +116,7 @@ fn main() {
}
}
printfln!("%? keys", n_keys);
println!("{} keys", n_keys);
io::println("\nTreeMap:");

View File

@ -55,7 +55,7 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
test();
let stop = precise_time_s();
printfln!("%s:\t\t%f ms", name, (stop - start) * 1000f);
println!("{}:\t\t{} ms", name, (stop - start) * 1000f);
}
fn shift_push() {

View File

@ -118,7 +118,7 @@ fn main() {
let elapsed = (stop - start);
let rate = (num_msgs as float) / elapsed;
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
printfln!(" %? messages / second", rate);
printfln!(" %? μs / message", 1000000. / rate);
println!("Sent {} messages in {} seconds", num_msgs, elapsed);
println!(" {} messages / second", rate);
println!(" {} μs / message", 1000000. / rate);
}

View File

@ -114,7 +114,7 @@ fn main() {
let elapsed = (stop - start);
let rate = (num_msgs as float) / elapsed;
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
printfln!(" %? messages / second", rate);
printfln!(" %? μs / message", 1000000. / rate);
println!("Sent {} messages in {} seconds", num_msgs, elapsed);
println!(" {} messages / second", rate);
println!(" {} μs / message", 1000000. / rate);
}

View File

@ -35,5 +35,5 @@ fn main() {
args
};
let n = from_str::<int>(args[1]).unwrap();
printfln!("Ack(3,%d): %d\n", n, ack(3, n));
println!("Ack(3,{}): {}\n", n, ack(3, n));
}

View File

@ -61,7 +61,7 @@ fn main() {
let stretch_depth = max_depth + 1;
let stretch_tree = bottom_up_tree(&stretch_arena, 0, stretch_depth);
printfln!("stretch tree of depth %d\t check: %d",
println!("stretch tree of depth {}\t check: {}",
stretch_depth,
item_check(stretch_tree));
@ -79,11 +79,11 @@ fn main() {
chk += item_check(temp_tree);
i += 1;
}
printfln!("%d\t trees of depth %d\t check: %d",
println!("{}\t trees of depth {}\t check: {}",
iterations * 2, depth, chk);
depth += 2;
}
printfln!("long lived tree of depth %d\t check: %d",
println!("long lived tree of depth {}\t check: {}",
max_depth,
item_check(long_lived_tree));
}

View File

@ -94,5 +94,5 @@ fn fannkuch_redux(n: i32) -> i32 {
#[fixed_stack_segment]
fn main() {
let n: i32 = FromStr::from_str(os::args()[1]).unwrap();
printfln!("Pfannkuchen(%d) = %d", n as int, fannkuch_redux(n) as int);
println!("Pfannkuchen({}) = {}", n as int, fannkuch_redux(n) as int);
}

View File

@ -31,5 +31,5 @@ fn main() {
args
};
let n = from_str::<int>(args[1]).unwrap();
printfln!("%d\n", fib(n));
println!("{}\n", fib(n));
}

View File

@ -82,7 +82,7 @@ struct PrintCallback(&'static str);
impl TableCallback for PrintCallback {
fn f(&self, entry: &mut Entry) {
printfln!("%d\t%s", entry.count as int, **self);
println!("{}\t{}", entry.count as int, **self);
}
}
@ -279,9 +279,9 @@ fn print_frequencies(frequencies: &Table, frame: i32) {
}
for vector.each |&(key, count)| {
printfln!("%s %.3f",
key.unpack(frame),
(count as float * 100.0) / (total_count as float));
println!("{} {:.3f}",
key.unpack(frame),
(count as float * 100.0) / (total_count as float));
}
}

View File

@ -16,7 +16,7 @@ fn main() {
let mut byte_acc: i8 = 0;
let mut bit_num: i32 = 0;
printfln!("P4\n%d %d", w as int, h as int);
println!("P4\n{} {}", w, h);
let mode = "w";
let stdout = fdopen(STDOUT_FILENO as c_int, transmute(&mode[0]));

View File

@ -143,9 +143,9 @@ fn main() {
let mut bodies = BODIES;
offset_momentum(&mut bodies);
printfln!("%.9f", energy(&bodies) as float);
println!("{:.9f}", energy(&bodies) as float);
advance(&mut bodies, 0.01, n);
printfln!("%.9f", energy(&bodies) as float);
println!("{:.9f}", energy(&bodies) as float);
}

View File

@ -63,5 +63,5 @@ fn main() {
mult_AtAv(v, u, tmp);
}
printfln!("%.9f", (dot(u,v) / dot(v,v)).sqrt() as float);
println!("{:.9f}", (dot(u,v) / dot(v,v)).sqrt() as float);
}

View File

@ -40,11 +40,11 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
while (true) {
match p.recv() {
1 => {
printfln!("%d\n", id);
println!("{}\n", id);
return;
}
token => {
info!("thread: %d got token: %d", id, token);
info2!("thread: {} got token: {}", id, token);
ch.send(token - 1);
if token <= n_tasks {
return;

View File

@ -18,7 +18,7 @@ struct Foo {
impl Foo {
pub fn printme(&mut self) {
printfln!("%d", self.x);
println!("{}", self.x);
}
}

View File

@ -9,5 +9,5 @@ fn a() -> &int {
fn main() {
let fifth = a();
printfln!("%d", *fifth);
println!("{}", *fifth);
}

View File

@ -22,5 +22,4 @@ fn main() {
let u = Thing {x: 2};
let _v = u.mul(&3); // This is ok
let w = u * 3; //~ ERROR binary operation * cannot be applied to type `Thing`
printfln!("%i", w.x);
}

View File

@ -14,5 +14,5 @@ fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cann
fn main() {
let v = &5;
printfln!("%d", f(v)());
println!("{}", f(v)());
}

View File

@ -28,7 +28,7 @@ fn innocent_looking_victim() {
match x {
Some(ref msg) => {
(f.c)(f, true);
printfln!(msg);
println!("{:?}", msg);
},
None => fail!("oops"),
}

View File

@ -13,7 +13,7 @@ struct Foo(int, int);
fn main() {
let x = Foo(1, 2);
match x { //~ ERROR non-exhaustive
Foo(1, b) => printfln!("%d", b),
Foo(2, b) => printfln!("%d", b)
Foo(1, b) => println!("{}", b),
Foo(2, b) => println!("{}", b)
}
}

View File

@ -33,5 +33,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(z.my_mut_slice(), z2.my_slice());
printfln!("%d", z[0]);
println!("{}", z[0]);
}

View File

@ -12,5 +12,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(z, z2);
printfln!("%d", z[0]);
println!("{}", z[0]);
}

View File

@ -13,5 +13,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&mut z[0], &z2[0]);
printfln!("%d", z[0]);
println!("{}", z[0]);
}

View File

@ -13,5 +13,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&mut z[0], &mut z2[0]);
printfln!("%d", z[0]);
println!("{}", z[0]);
}

View File

@ -18,7 +18,7 @@ trait Stuff {
impl Stuff for Foo {
fn printme(&self) {
printfln!("%d", self.x);
println!("{}", self.x);
}
}

View File

@ -10,5 +10,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&z[0], &z2[0]);
printfln!("%d", z[0]);
println!("{}", z[0]);
}

View File

@ -19,7 +19,7 @@ pub fn main() {
//info!("%?", bt0);
do 3u.to(10u) |i| {
printfln!("%u", i);
println!("{}", i);
//let bt1 = sys::frame_address();
//info!("%?", bt1);

View File

@ -17,7 +17,7 @@ pub fn main() {
//let bt0 = sys::rusti::frame_address(1u32);
//info!("%?", bt0);
do cci_iter_lib::iter([1, 2, 3]) |i| {
printf!("%d", *i);
println!("{}", *i);
//assert!(bt0 == sys::rusti::frame_address(2u32));
}
}

View File

@ -23,7 +23,7 @@ pub fn main() {
//let bt0 = sys::frame_address();
//info!("%?", bt0);
do iter(~[1u, 2u, 3u]) |i| {
printfln!("%u", i);
println!("{}", i);
//let bt1 = sys::frame_address();
//info!("%?", bt1);

View File

@ -25,9 +25,9 @@ static k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}};
static m : int = k.c.e;
pub fn main() {
printfln!(p);
printfln!(q);
printfln!(t);
println!("{:?}", p);
println!("{:?}", q);
println!("{:?}", t);
assert_eq!(p, 3);
assert_eq!(q, 3);
assert_eq!(t, 20);

View File

@ -21,5 +21,5 @@ static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0,
pub fn main() {
let (p, _) = y.x;
assert_eq!(p, - 1085102592571150096);
printfln!("0x%x", p as uint);
println!("{:#x}", p);
}

View File

@ -15,8 +15,8 @@ static x: &'static int = &10;
static y: &'static Pair<'static> = &Pair {a: 15, b: x};
pub fn main() {
printfln!("x = %?", *x);
printfln!("y = {a: %?, b: %?}", y.a, *(y.b));
println!("x = {}", *x);
println!("y = \\{a: {}, b: {}\\}", y.a, *(y.b));
assert_eq!(*x, 10);
assert_eq!(*(y.b), 10);
}

View File

@ -32,6 +32,6 @@ pub fn main() {
assert_eq!(z.b, 22);
assert_eq!(w.a, 5);
assert_eq!(w.c, 3);
printfln!("0x%x", x.b as uint);
printfln!("0x%x", z.c as uint);
println!("{:#x}", x.b);
println!("{:#x}", z.c);
}

View File

@ -12,8 +12,8 @@ static x : [int, ..4] = [1,2,3,4];
static y : &'static [int] = &[1,2,3,4];
pub fn main() {
printfln!(x[1]);
printfln!(y[1]);
println!("{:?}", x[1]);
println!("{:?}", y[1]);
assert_eq!(x[1], 2);
assert_eq!(x[3], 4);
assert_eq!(x[3], y[3]);

View File

@ -16,5 +16,5 @@ struct Foo {
pub fn main() {
let a = Foo { x: 1, y: 2 };
let c = Foo { x: 4, .. a};
printfln!(c);
println!("{:?}", c);
}

View File

@ -82,5 +82,5 @@ pub fn main() {
a);
let sum = foldl(filt, 0u, |accum, &&n: uint| accum + n );
printfln!("%u", sum);
println!("{}", sum);
}

View File

@ -40,7 +40,7 @@ pub fn main() {
let bools2 = to_bools(Storage{storage: ~[0b01100100]});
for i in range(0u, 8) {
printfln!("%u => %u vs %u", i, bools[i] as uint, bools2[i] as uint);
println!("{} => {} vs {}", i, bools[i], bools2[i]);
}
assert_eq!(bools, bools2);

View File

@ -4,5 +4,5 @@ pub fn main() {
x += 1;
}
assert_eq!(x, 4096);
printfln!("x = %u", x);
println!("x = {}", x);
}

View File

@ -40,11 +40,11 @@ pub fn main() {
// the following compiles and works properly
let v1: Vec2 = a * 3f;
printfln!("%f %f", v1.x, v1.y);
println!("{} {}", v1.x, v1.y);
// the following compiles but v2 will not be Vec2 yet and
// using it later will cause an error that the type of v2
// must be known
let v2 = a * 3f;
printfln!("%f %f", v2.x, v2.y); // error regarding v2's type
println!("{} {}", v2.x, v2.y); // error regarding v2's type
}

View File

@ -35,5 +35,5 @@ impl Shape {
pub fn main(){
let s = Circle(Point { x: 1f, y: 2f }, 3f);
printfln!("%f", s.area(s));
println!("{}", s.area(s));
}

View File

@ -18,7 +18,7 @@ struct S {
impl T for S {
fn print(&self) {
printfln!(self);
println!("{:?}", self);
}
}

View File

@ -12,7 +12,7 @@
type ErrPrinter = &fn(&str, &str);
fn example_err(prog: &str, arg: &str) {
printfln!("%s: %s", prog, arg)
println!("{}: {}", prog, arg)
}
fn exit(+print: ErrPrinter, prog: &str, arg: &str) {

View File

@ -114,7 +114,6 @@ fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result {
//io::println(cmd);
sb.write_str(cmd);
let res = parse_response(@sb as @io::Reader);
//printfln!(res);
res
}
@ -122,7 +121,7 @@ fn query2(cmd: ~[~str]) -> Result {
let _cmd = cmd_to_str(cmd);
do io::with_str_reader(~"$3\r\nXXX\r\n") |sb| {
let res = parse_response(@sb as @io::Reader);
printfln!(res);
println!("{:?}", res);
res
}
}

View File

@ -4,5 +4,5 @@ pub fn main() {
count += 1;
}
assert_eq!(count, 999_999);
printfln!("%u", count);
println!("{}", count);
}

View File

@ -29,6 +29,6 @@ static mut frobulator: uint = 0xdeadbeef;
pub fn main() {
unsafe {
frobulator = 0xcafebabe;
printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);
println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
}
}

View File

@ -35,5 +35,5 @@ fn Foo(x: int, y: int) -> Foo {
pub fn main() {
let foo = Foo(3, 20);
printfln!("%d %d", foo.sum(), foo.product());
println!("{} {}", foo.sum(), foo.product());
}

View File

@ -13,5 +13,5 @@ use std::io::println;
static FOO: int = 3;
pub fn main() {
printfln!("%d", FOO);
println!("{}", FOO);
}

View File

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::io::println;
static FOO: [int, ..3] = [1, 2, 3];
pub fn main() {
printfln!("%d %d %d", FOO[0], FOO[1], FOO[2]);
println!("{} {} {}", FOO[0], FOO[1], FOO[2]);
}

View File

@ -16,6 +16,6 @@ fn compute(i: mytype) -> int { return i.val + 20; }
pub fn main() {
let myval = mytype(Mytype{compute: compute, val: 30});
printfln!("%d", compute(myval));
println!("{}", compute(myval));
assert_eq!((myval.compute)(myval), 50);
}

View File

@ -17,6 +17,6 @@ pub fn main() {
let mut arena = Arena::new();
let p = &mut arena;
let x = p.alloc(|| 4u);
printf!("%u", *x);
println!("{}", *x);
assert_eq!(*x, 4u);
}

View File

@ -30,5 +30,5 @@ fn test<T:Dot> (n:int, i:int, first:T, second:T) ->int {
}
pub fn main() {
let n = test(1, 0, Nil, Nil);
printfln!("%d", n);
println!("{}", n);
}

View File

@ -647,9 +647,9 @@ pub fn main() {
let r = u.vals.clone();
for s in r.iter() {
printfln!("val: %s", *s);
println!("val: {}", *s);
}
error!("%?", u.vals.clone());
error2!("{:?}", u.vals.clone());
assert_eq!(u.vals.clone(),
~[ ~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3", ~"12"]);
}

View File

@ -161,7 +161,7 @@ pub fn main() {
visit_ty::<~[int]>(&mut v);
for s in v.types.iter() {
printfln!("type: %s", (*s).clone());
println!("type: {}", (*s).clone());
}
assert_eq!((*v.types).clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
}

View File

@ -16,6 +16,6 @@ struct Foo {
pub fn main() {
let a = Foo { x: 1, y: 2 };
match a {
Foo { x: x, y: y } => printfln!("yes, %d, %d", x, y)
Foo { x: x, y: y } => println!("yes, {}, {}", x, y)
}
}

View File

@ -99,7 +99,7 @@ impl FloatExt for f64 {}
impl FloatExt for float {}
fn test_float_ext<T:FloatExt>(n: T) { printfln!(n < n) }
fn test_float_ext<T:FloatExt>(n: T) { println!("{}", n < n) }
pub fn main() {
test_float_ext(1f32);

View File

@ -16,7 +16,7 @@ pub trait NumExt: Eq + Ord + Num + NumCast {}
impl NumExt for f32 {}
fn num_eq_one<T:NumExt>(n: T) {
printfln!(n == NumCast::from(1))
println!("{}", n == NumCast::from(1))
}
pub fn main() {

View File

@ -12,5 +12,5 @@ struct Foo(int, int);
pub fn main() {
let x = Foo(1, 2);
printfln!(x);
println!("{:?}", x);
}

View File

@ -13,7 +13,7 @@ struct Foo(int, int);
pub fn main() {
let x = Foo(1, 2);
let Foo(y, z) = x;
printfln!("%d %d", y, z);
println!("{} {}", y, z);
assert_eq!(y, 1);
assert_eq!(z, 2);
}

View File

@ -16,7 +16,7 @@ pub fn main() {
Foo(a, b) => {
assert_eq!(a, 1);
assert_eq!(b, 2);
printfln!("%d %d", a, b);
println!("{} {}", a, b);
}
}
}

View File

@ -10,5 +10,5 @@
pub fn main() {
let x: [int, ..4] = [1, 2, 3, 4];
printfln!("%d", x[0]);
println!("{}", x[0]);
}

View File

@ -5,6 +5,6 @@ pub fn main() {
[1, ..ref tail] => &tail[0],
_ => unreachable!()
};
printfln!("%d", *el);
println!("{}", *el);
}
}