Change 'print(fmt!(...))' to printf!/printfln! in src/lib*

This commit is contained in:
Birunthan Mohanathas 2013-07-22 19:03:39 +03:00 committed by Daniel Micay
parent af5a17b7d0
commit d047cf1ec6
27 changed files with 102 additions and 111 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -1263,7 +1263,7 @@ mod test_set {
let mut n = 0; let mut n = 0;
for m.iter().advance |x| { for m.iter().advance |x| {
println(fmt!("%?", x)); printfln!(x);
assert_eq!(*x, n); assert_eq!(*x, n);
n += 1 n += 1
} }

View file

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

View file

@ -191,15 +191,15 @@ pub fn list_passes() {
io::println("\nAnalysis Passes:"); io::println("\nAnalysis Passes:");
for analysis_passes.iter().advance |&(name, desc)| { for analysis_passes.iter().advance |&(name, desc)| {
io::println(fmt!(" %-30s -- %s", name, desc)); printfln!(" %-30s -- %s", name, desc);
} }
io::println("\nTransformation Passes:"); io::println("\nTransformation Passes:");
for transform_passes.iter().advance |&(name, desc)| { for transform_passes.iter().advance |&(name, desc)| {
io::println(fmt!(" %-30s -- %s", name, desc)); printfln!(" %-30s -- %s", name, desc);
} }
io::println("\nUtility Passes:"); io::println("\nUtility Passes:");
for utility_passes.iter().advance |&(name, desc)| { for utility_passes.iter().advance |&(name, desc)| {
io::println(fmt!(" %-30s -- %s", name, desc)); printfln!(" %-30s -- %s", name, desc);
} }
} }
@ -344,7 +344,7 @@ fn passes_exist() {
if failed.len() > 0 { if failed.len() > 0 {
io::println("Some passes don't exist:"); io::println("Some passes don't exist:");
for failed.iter().advance |&n| { for failed.iter().advance |&n| {
io::println(fmt!(" %s", n)); printfln!(" %s", n);
} }
fail!(); fail!();
} }

View file

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

View file

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

View file

@ -3011,17 +3011,15 @@ pub fn trans_crate(sess: session::Session,
write_metadata(ccx, crate); write_metadata(ccx, crate);
if ccx.sess.trans_stats() { if ccx.sess.trans_stats() {
io::println("--- trans stats ---"); io::println("--- trans stats ---");
io::println(fmt!("n_static_tydescs: %u", printfln!("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
ccx.stats.n_static_tydescs)); printfln!("n_glues_created: %u", ccx.stats.n_glues_created);
io::println(fmt!("n_glues_created: %u", printfln!("n_null_glues: %u", ccx.stats.n_null_glues);
ccx.stats.n_glues_created)); printfln!("n_real_glues: %u", ccx.stats.n_real_glues);
io::println(fmt!("n_null_glues: %u", ccx.stats.n_null_glues));
io::println(fmt!("n_real_glues: %u", ccx.stats.n_real_glues));
io::println(fmt!("n_fns: %u", ccx.stats.n_fns)); printfln!("n_fns: %u", ccx.stats.n_fns);
io::println(fmt!("n_monos: %u", ccx.stats.n_monos)); printfln!("n_monos: %u", ccx.stats.n_monos);
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines)); printfln!("n_inlines: %u", ccx.stats.n_inlines);
io::println(fmt!("n_closures: %u", ccx.stats.n_closures)); printfln!("n_closures: %u", ccx.stats.n_closures);
io::println("fn stats:"); io::println("fn stats:");
do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| { do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| {
insns_a > insns_b insns_a > insns_b
@ -3029,14 +3027,14 @@ pub fn trans_crate(sess: session::Session,
for ccx.stats.fn_stats.iter().advance |tuple| { for ccx.stats.fn_stats.iter().advance |tuple| {
match *tuple { match *tuple {
(ref name, ms, insns) => { (ref name, ms, insns) => {
io::println(fmt!("%u insns, %u ms, %s", insns, ms, *name)); printfln!("%u insns, %u ms, %s", insns, ms, *name);
} }
} }
} }
} }
if ccx.sess.count_llvm_insns() { if ccx.sess.count_llvm_insns() {
for ccx.stats.llvm_insns.iter().advance |(k, v)| { for ccx.stats.llvm_insns.iter().advance |(k, v)| {
io::println(fmt!("%-7u %s", *v, *k)); printfln!("%-7u %s", *v, *k);
} }
} }

View file

@ -654,9 +654,9 @@ pub fn trans_call_inner(in_cx: @mut Block,
// Uncomment this to debug calls. // Uncomment this to debug calls.
/* /*
io::println(fmt!("calling: %s", bcx.val_to_str(llfn))); printfln!("calling: %s", bcx.val_to_str(llfn));
for llargs.iter().advance |llarg| { for llargs.iter().advance |llarg| {
io::println(fmt!("arg: %s", bcx.val_to_str(*llarg))); printfln!("arg: %s", bcx.val_to_str(*llarg));
} }
io::println("---"); io::println("---");
*/ */

View file

@ -37,7 +37,6 @@ use util::ppaux::ty_to_short_str;
use middle::trans::type_::Type; use middle::trans::type_::Type;
use std::io;
use std::libc::c_uint; use std::libc::c_uint;
use std::str; use std::str;
use syntax::ast; use syntax::ast;
@ -649,8 +648,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
let llty = type_of(ccx, t); let llty = type_of(ccx, t);
if ccx.sess.count_type_sizes() { if ccx.sess.count_type_sizes() {
io::println(fmt!("%u\t%s", llsize_of_real(ccx, llty), printfln!("%u\t%s", llsize_of_real(ccx, llty),
ppaux::ty_to_str(ccx.tcx, t))); ppaux::ty_to_str(ccx.tcx, t));
} }
let llsize = llsize_of(ccx, llty); let llsize = llsize_of(ccx, llty);

View file

@ -2712,7 +2712,7 @@ pub fn node_id_to_trait_ref(cx: ctxt, id: ast::node_id) -> @ty::TraitRef {
} }
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t { pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
//io::println(fmt!("%?/%?", id, cx.node_types.len())); //printfln!("%?/%?", id, cx.node_types.len());
match cx.node_types.find(&(id as uint)) { match cx.node_types.find(&(id as uint)) {
Some(&t) => t, Some(&t) => t,
None => cx.sess.bug( None => cx.sess.bug(

View file

@ -128,28 +128,28 @@ pub fn version(argv0: &str) {
let mut vers = ~"unknown version"; let mut vers = ~"unknown version";
let env_vers = env!("CFG_VERSION"); let env_vers = env!("CFG_VERSION");
if env_vers.len() != 0 { vers = env_vers.to_owned(); } if env_vers.len() != 0 { vers = env_vers.to_owned(); }
io::println(fmt!("%s %s", argv0, vers)); printfln!("%s %s", argv0, vers);
io::println(fmt!("host: %s", host_triple())); printfln!("host: %s", host_triple());
} }
pub fn usage(argv0: &str) { pub fn usage(argv0: &str) {
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
io::println(fmt!("%s\ printfln!("%s\
Additional help: Additional help:
-W help Print 'lint' options and default settings -W help Print 'lint' options and default settings
-Z help Print internal options for debugging rustc\n", -Z help Print internal options for debugging rustc\n",
groups::usage(message, optgroups()))); groups::usage(message, optgroups()));
} }
pub fn describe_warnings() { pub fn describe_warnings() {
use extra::sort::Sort; use extra::sort::Sort;
io::println(fmt!(" printfln!("
Available lint options: Available lint options:
-W <foo> Warn about <foo> -W <foo> Warn about <foo>
-A <foo> Allow <foo> -A <foo> Allow <foo>
-D <foo> Deny <foo> -D <foo> Deny <foo>
-F <foo> Forbid <foo> (deny, and deny all overrides) -F <foo> Forbid <foo> (deny, and deny all overrides)
")); ");
let lint_dict = lint::get_lint_dict(); let lint_dict = lint::get_lint_dict();
let mut lint_dict = lint_dict.consume() let mut lint_dict = lint_dict.consume()
@ -164,28 +164,28 @@ Available lint options:
fn padded(max: uint, s: &str) -> ~str { fn padded(max: uint, s: &str) -> ~str {
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
} }
io::println(fmt!("\nAvailable lint checks:\n")); printfln!("\nAvailable lint checks:\n");
io::println(fmt!(" %s %7.7s %s", printfln!(" %s %7.7s %s",
padded(max_key, "name"), "default", "meaning")); padded(max_key, "name"), "default", "meaning");
io::println(fmt!(" %s %7.7s %s\n", printfln!(" %s %7.7s %s\n",
padded(max_key, "----"), "-------", "-------")); padded(max_key, "----"), "-------", "-------");
for lint_dict.consume_iter().advance |(spec, name)| { for lint_dict.consume_iter().advance |(spec, name)| {
let name = name.replace("_", "-"); let name = name.replace("_", "-");
io::println(fmt!(" %s %7.7s %s", printfln!(" %s %7.7s %s",
padded(max_key, name), padded(max_key, name),
lint::level_to_str(spec.default), lint::level_to_str(spec.default),
spec.desc)); spec.desc);
} }
io::println(""); io::println("");
} }
pub fn describe_debug_flags() { pub fn describe_debug_flags() {
io::println(fmt!("\nAvailable debug options:\n")); printfln!("\nAvailable debug options:\n");
let r = session::debugging_opts_map(); let r = session::debugging_opts_map();
for r.iter().advance |tuple| { for r.iter().advance |tuple| {
match *tuple { match *tuple {
(ref name, ref desc, _) => { (ref name, ref desc, _) => {
io::println(fmt!(" -Z %-20s -- %s", *name, *desc)); printfln!(" -Z %-20s -- %s", *name, *desc);
} }
} }
} }

View file

@ -14,7 +14,6 @@ use syntax::codemap::{span};
use syntax::visit; use syntax::visit;
use std::hashmap::HashSet; use std::hashmap::HashSet;
use std::io;
use extra; use extra;
pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T { pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
@ -22,7 +21,7 @@ pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
let start = extra::time::precise_time_s(); let start = extra::time::precise_time_s();
let rv = thunk(); let rv = thunk();
let end = extra::time::precise_time_s(); let end = extra::time::precise_time_s();
io::println(fmt!("time: %3.3f s\t%s", end - start, what)); printfln!("time: %3.3f s\t%s", end - start, what);
rv rv
} }

View file

@ -74,7 +74,7 @@ pub fn usage() {
println("Options:\n"); println("Options:\n");
let r = opts(); let r = opts();
for r.iter().advance |opt| { for r.iter().advance |opt| {
println(fmt!(" %s", opt.second())); printfln!(" %s", opt.second());
} }
println(""); println("");
} }

View file

@ -23,7 +23,6 @@ extern mod extra;
extern mod rustc; extern mod rustc;
extern mod syntax; extern mod syntax;
use std::io;
use std::os; use std::os;
use config::Config; use config::Config;
@ -69,7 +68,7 @@ pub fn main() {
let config = match config::parse_config(args) { let config = match config::parse_config(args) {
Ok(config) => config, Ok(config) => config,
Err(err) => { Err(err) => {
io::println(fmt!("error: %s", err)); printfln!("error: %s", err);
return; return;
} }
}; };

View file

@ -334,7 +334,7 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
None => { }, None => { },
} }
if (should_compile) { if (should_compile) {
println(fmt!("compiling %s...", src_filename)); printfln!("compiling %s...", src_filename);
driver::compile_upto(sess, cfg, &input, driver::cu_everything, driver::compile_upto(sess, cfg, &input, driver::cu_everything,
Some(outputs)); Some(outputs));
true true
@ -413,8 +413,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
if loaded_crates.is_empty() { if loaded_crates.is_empty() {
println("no crates loaded"); println("no crates loaded");
} else { } else {
println(fmt!("crates loaded: %s", printfln!("crates loaded: %s", loaded_crates.connect(", "));
loaded_crates.connect(", ")));
} }
} }
~"{" => { ~"{" => {

View file

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

View file

@ -326,7 +326,7 @@ pub trait IteratorUtil<A> {
/// use std::iterator::Counter; /// use std::iterator::Counter;
/// ///
/// for Counter::new(0, 10).advance |i| { /// for Counter::new(0, 10).advance |i| {
/// io::println(fmt!("%d", i)); /// printfln!("%d", i);
/// } /// }
/// ~~~ /// ~~~
fn advance(&mut self, f: &fn(A) -> bool) -> bool; fn advance(&mut self, f: &fn(A) -> bool) -> bool;

View file

@ -103,7 +103,7 @@ fn range_step_core(start: $T, stop: $T, step: $T_SIGNED, r: Range, it: &fn($T) -
/// let nums = [1,2,3,4,5,6,7]; /// let nums = [1,2,3,4,5,6,7];
/// ///
/// for uint::range_step(0, nums.len() - 1, 2) |i| { /// for uint::range_step(0, nums.len() - 1, 2) |i| {
/// println(fmt!("%d & %d", nums[i], nums[i+1])); /// printfln!("%d & %d", nums[i], nums[i+1]);
/// } /// }
/// ~~~ /// ~~~
/// ///

View file

@ -28,7 +28,7 @@ use std::rand::RngUtil;
fn main() { fn main() {
let mut rng = rand::rng(); let mut rng = rand::rng();
if rng.gen() { // bool if rng.gen() { // bool
println(fmt!("int: %d, uint: %u", rng.gen(), rng.gen())) printfln!("int: %d, uint: %u", rng.gen(), rng.gen())
} }
} }
~~~ ~~~
@ -38,7 +38,7 @@ use std::rand;
fn main () { fn main () {
let tuple_ptr = rand::random::<~(f64, char)>(); let tuple_ptr = rand::random::<~(f64, char)>();
println(fmt!("%?", tuple_ptr)) printfln!(tuple_ptr)
} }
~~~ ~~~
*/ */
@ -301,7 +301,7 @@ pub trait RngUtil {
* *
* fn main() { * fn main() {
* let mut rng = rand::rng(); * let mut rng = rand::rng();
* println(fmt!("%b",rng.gen_weighted_bool(3))); * printfln!("%b", rng.gen_weighted_bool(3));
* } * }
* ~~~ * ~~~
*/ */
@ -335,7 +335,7 @@ pub trait RngUtil {
* *
* fn main() { * fn main() {
* let mut rng = rand::rng(); * let mut rng = rand::rng();
* println(fmt!("%?",rng.gen_bytes(8))); * printfln!(rng.gen_bytes(8));
* } * }
* ~~~ * ~~~
*/ */
@ -352,7 +352,7 @@ pub trait RngUtil {
* *
* fn main() { * fn main() {
* let mut rng = rand::rng(); * let mut rng = rand::rng();
* println(fmt!("%d",rng.choose([1,2,4,8,16,32]))); * printfln!("%d", rng.choose([1,2,4,8,16,32]));
* } * }
* ~~~ * ~~~
*/ */
@ -375,7 +375,7 @@ pub trait RngUtil {
* let x = [rand::Weighted {weight: 4, item: 'a'}, * let x = [rand::Weighted {weight: 4, item: 'a'},
* rand::Weighted {weight: 2, item: 'b'}, * rand::Weighted {weight: 2, item: 'b'},
* rand::Weighted {weight: 2, item: 'c'}]; * rand::Weighted {weight: 2, item: 'c'}];
* println(fmt!("%c",rng.choose_weighted(x))); * printfln!("%c", rng.choose_weighted(x));
* } * }
* ~~~ * ~~~
*/ */
@ -396,7 +396,7 @@ pub trait RngUtil {
* let x = [rand::Weighted {weight: 4, item: 'a'}, * let x = [rand::Weighted {weight: 4, item: 'a'},
* rand::Weighted {weight: 2, item: 'b'}, * rand::Weighted {weight: 2, item: 'b'},
* rand::Weighted {weight: 2, item: 'c'}]; * rand::Weighted {weight: 2, item: 'c'}];
* println(fmt!("%?",rng.choose_weighted_option(x))); * printfln!(rng.choose_weighted_option(x));
* } * }
* ~~~ * ~~~
*/ */
@ -418,7 +418,7 @@ pub trait RngUtil {
* let x = [rand::Weighted {weight: 4, item: 'a'}, * let x = [rand::Weighted {weight: 4, item: 'a'},
* rand::Weighted {weight: 2, item: 'b'}, * rand::Weighted {weight: 2, item: 'b'},
* rand::Weighted {weight: 2, item: 'c'}]; * rand::Weighted {weight: 2, item: 'c'}];
* println(fmt!("%?",rng.weighted_vec(x))); * printfln!(rng.weighted_vec(x));
* } * }
* ~~~ * ~~~
*/ */
@ -435,7 +435,7 @@ pub trait RngUtil {
* *
* fn main() { * fn main() {
* let mut rng = rand::rng(); * let mut rng = rand::rng();
* println(fmt!("%?",rng.shuffle([1,2,3]))); * printfln!(rng.shuffle([1,2,3]));
* } * }
* ~~~ * ~~~
*/ */
@ -454,9 +454,9 @@ pub trait RngUtil {
* let mut rng = rand::rng(); * let mut rng = rand::rng();
* let mut y = [1,2,3]; * let mut y = [1,2,3];
* rng.shuffle_mut(y); * rng.shuffle_mut(y);
* println(fmt!("%?",y)); * printfln!(y);
* rng.shuffle_mut(y); * rng.shuffle_mut(y);
* println(fmt!("%?",y)); * printfln!(y);
* } * }
* ~~~ * ~~~
*/ */

View file

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

View file

@ -1727,7 +1727,7 @@ impl<'self> StrSlice<'self> for &'self str {
* let i = 0u; * let i = 0u;
* while i < s.len() { * while i < s.len() {
* let CharRange {ch, next} = s.char_range_at(i); * let CharRange {ch, next} = s.char_range_at(i);
* std::io::println(fmt!("%u: %c",i,ch)); * printfln!("%u: %c", i, ch);
* i = next; * i = next;
* } * }
* ~~~ * ~~~

View file

@ -833,7 +833,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
* ~~~ {.rust} * ~~~ {.rust}
* let v = &[1,2,3,4]; * let v = &[1,2,3,4];
* for v.window_iter().advance |win| { * for v.window_iter().advance |win| {
* io::println(fmt!("%?", win)); * printfln!(win);
* } * }
* ~~~ * ~~~
* *
@ -862,7 +862,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
* ~~~ {.rust} * ~~~ {.rust}
* let v = &[1,2,3,4,5]; * let v = &[1,2,3,4,5];
* for v.chunk_iter().advance |win| { * for v.chunk_iter().advance |win| {
* io::println(fmt!("%?", win)); * printfln!(win);
* } * }
* ~~~ * ~~~
* *

View file

@ -23,8 +23,6 @@ use parse::token::{get_ident_interner, special_idents, gensym_ident, ident_to_st
use parse::token::{FAT_ARROW, SEMI, nt_matchers, nt_tt}; use parse::token::{FAT_ARROW, SEMI, nt_matchers, nt_tt};
use print; use print;
use std::io;
pub fn add_new_extension(cx: @ExtCtxt, pub fn add_new_extension(cx: @ExtCtxt,
sp: span, sp: span,
name: ident, name: ident,
@ -82,11 +80,11 @@ pub fn add_new_extension(cx: @ExtCtxt,
-> MacResult { -> MacResult {
if cx.trace_macros() { if cx.trace_macros() {
io::println(fmt!("%s! { %s }", printfln!("%s! { %s }",
cx.str_of(name), cx.str_of(name),
print::pprust::tt_to_str( print::pprust::tt_to_str(
&ast::tt_delim(@mut arg.to_owned()), &ast::tt_delim(@mut arg.to_owned()),
get_ident_interner()))); get_ident_interner()));
} }
// Which arm's failure should we report? (the one furthest along) // Which arm's failure should we report? (the one furthest along)

View file

@ -686,7 +686,7 @@ mod test {
use std::io; use std::io;
#[test] fn t1() { #[test] fn t1() {
let a = fresh_name("ghi"); let a = fresh_name("ghi");
io::println(fmt!("interned name: %u,\ntextual name: %s\n", printfln!("interned name: %u,\ntextual name: %s\n",
a,interner_get(a))); a, interner_get(a));
} }
} }