Change 'print(fmt!(...))' to printf!/printfln! in src/lib*
This commit is contained in:
parent
af5a17b7d0
commit
d047cf1ec6
@ -75,7 +75,7 @@ impl<'self> ToBase64 for &'self [u8] {
|
||||
*
|
||||
* fn main () {
|
||||
* 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 () {
|
||||
* 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 () {
|
||||
* let str = [52,32].to_base64(standard);
|
||||
* println(fmt!("%s", str));
|
||||
* printfln!("%s", str);
|
||||
* let bytes = str.from_base64();
|
||||
* println(fmt!("%?",bytes));
|
||||
* printfln!("%?", bytes);
|
||||
* }
|
||||
* ~~~
|
||||
*/
|
||||
@ -271,11 +271,11 @@ impl<'self> FromBase64 for &'self str {
|
||||
*
|
||||
* fn main () {
|
||||
* let hello_str = "Hello, World".to_base64(standard);
|
||||
* println(fmt!("%s",hello_str));
|
||||
* printfln!("%s", hello_str);
|
||||
* let bytes = hello_str.from_base64();
|
||||
* println(fmt!("%?",bytes));
|
||||
* printfln!("%?", bytes);
|
||||
* let result_str = str::from_bytes(bytes);
|
||||
* println(fmt!("%s",result_str));
|
||||
* printfln!("%s", result_str);
|
||||
* }
|
||||
* ~~~
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@
|
||||
* # fn make_a_sandwich() {};
|
||||
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
|
||||
* make_a_sandwich();
|
||||
* println(fmt!("fib(5000) = %?", delayed_fib.get()))
|
||||
* printfln!("fib(5000) = %?", delayed_fib.get())
|
||||
* ~~~
|
||||
*/
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
* }
|
||||
*
|
||||
* fn print_usage(program: &str, _opts: &[Opt]) {
|
||||
* println(fmt!("Usage: %s [options]", program));
|
||||
* printfln!("Usage: %s [options]", program);
|
||||
* println("-o\t\tOutput");
|
||||
* println("-h --help\tUsage");
|
||||
* }
|
||||
|
@ -103,6 +103,6 @@ fn test_task_pool() {
|
||||
};
|
||||
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
|
||||
for 8.times {
|
||||
pool.execute(|i| println(fmt!("Hello from thread %u!", *i)));
|
||||
pool.execute(|i| printfln!("Hello from thread %u!", *i));
|
||||
}
|
||||
}
|
||||
|
@ -1263,7 +1263,7 @@ mod test_set {
|
||||
|
||||
let mut n = 0;
|
||||
for m.iter().advance |x| {
|
||||
println(fmt!("%?", x));
|
||||
printfln!(x);
|
||||
assert_eq!(*x, n);
|
||||
n += 1
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
|
||||
match find_cmd(command_string) {
|
||||
Some(command) => {
|
||||
match command.action {
|
||||
CallMain(prog, _) => io::println(fmt!(
|
||||
CallMain(prog, _) => printfln!(
|
||||
"The %s command is an alias for the %s program.",
|
||||
command.cmd, prog)),
|
||||
command.cmd, prog),
|
||||
_ => ()
|
||||
}
|
||||
match command.usage_full {
|
||||
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
|
||||
UsgStr(msg) => printfln!("%s\n", msg),
|
||||
UsgCall(f) => f(),
|
||||
}
|
||||
Valid(0)
|
||||
@ -211,8 +211,7 @@ fn usage() {
|
||||
|
||||
for COMMANDS.iter().advance |command| {
|
||||
let padding = " ".repeat(INDENT - command.cmd.len());
|
||||
io::println(fmt!(" %s%s%s",
|
||||
command.cmd, padding, command.usage_line));
|
||||
printfln!(" %s%s%s", command.cmd, padding, command.usage_line);
|
||||
}
|
||||
|
||||
io::print(
|
||||
|
@ -191,15 +191,15 @@ pub fn list_passes() {
|
||||
|
||||
io::println("\nAnalysis Passes:");
|
||||
for analysis_passes.iter().advance |&(name, desc)| {
|
||||
io::println(fmt!(" %-30s -- %s", name, desc));
|
||||
printfln!(" %-30s -- %s", name, desc);
|
||||
}
|
||||
io::println("\nTransformation Passes:");
|
||||
for transform_passes.iter().advance |&(name, desc)| {
|
||||
io::println(fmt!(" %-30s -- %s", name, desc));
|
||||
printfln!(" %-30s -- %s", name, desc);
|
||||
}
|
||||
io::println("\nUtility Passes:");
|
||||
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 {
|
||||
io::println("Some passes don't exist:");
|
||||
for failed.iter().advance |&n| {
|
||||
io::println(fmt!(" %s", n));
|
||||
printfln!(" %s", n);
|
||||
}
|
||||
fail!();
|
||||
}
|
||||
|
@ -1624,16 +1624,16 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
|
||||
}
|
||||
|
||||
io::println("metadata stats:");
|
||||
io::println(fmt!(" inline bytes: %u", ecx.stats.inline_bytes));
|
||||
io::println(fmt!(" attribute bytes: %u", ecx.stats.attr_bytes));
|
||||
io::println(fmt!(" dep bytes: %u", ecx.stats.dep_bytes));
|
||||
io::println(fmt!(" lang item bytes: %u", ecx.stats.lang_item_bytes));
|
||||
io::println(fmt!(" link args bytes: %u", ecx.stats.link_args_bytes));
|
||||
io::println(fmt!(" misc bytes: %u", ecx.stats.misc_bytes));
|
||||
io::println(fmt!(" item bytes: %u", ecx.stats.item_bytes));
|
||||
io::println(fmt!(" index bytes: %u", ecx.stats.index_bytes));
|
||||
io::println(fmt!(" zero bytes: %u", ecx.stats.zero_bytes));
|
||||
io::println(fmt!(" total bytes: %u", ecx.stats.total_bytes));
|
||||
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!(" 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);
|
||||
}
|
||||
|
||||
// Pad this, since something (LLVM, presumably) is cutting off the
|
||||
|
@ -93,16 +93,16 @@ pub fn check_crate(
|
||||
|
||||
if tcx.sess.borrowck_stats() {
|
||||
io::println("--- borrowck stats ---");
|
||||
io::println(fmt!("paths requiring guarantees: %u",
|
||||
bccx.stats.guaranteed_paths));
|
||||
io::println(fmt!("paths requiring loans : %s",
|
||||
make_stat(bccx, bccx.stats.loaned_paths_same)));
|
||||
io::println(fmt!("paths requiring imm loans : %s",
|
||||
make_stat(bccx, bccx.stats.loaned_paths_imm)));
|
||||
io::println(fmt!("stable paths : %s",
|
||||
make_stat(bccx, bccx.stats.stable_paths)));
|
||||
io::println(fmt!("paths requiring purity : %s",
|
||||
make_stat(bccx, bccx.stats.req_pure_paths)));
|
||||
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));
|
||||
}
|
||||
|
||||
return (bccx.root_map, bccx.write_guard_map);
|
||||
|
@ -3011,17 +3011,15 @@ pub fn trans_crate(sess: session::Session,
|
||||
write_metadata(ccx, crate);
|
||||
if ccx.sess.trans_stats() {
|
||||
io::println("--- trans stats ---");
|
||||
io::println(fmt!("n_static_tydescs: %u",
|
||||
ccx.stats.n_static_tydescs));
|
||||
io::println(fmt!("n_glues_created: %u",
|
||||
ccx.stats.n_glues_created));
|
||||
io::println(fmt!("n_null_glues: %u", ccx.stats.n_null_glues));
|
||||
io::println(fmt!("n_real_glues: %u", ccx.stats.n_real_glues));
|
||||
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);
|
||||
|
||||
io::println(fmt!("n_fns: %u", ccx.stats.n_fns));
|
||||
io::println(fmt!("n_monos: %u", ccx.stats.n_monos));
|
||||
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines));
|
||||
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
|
||||
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);
|
||||
io::println("fn stats:");
|
||||
do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, 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| {
|
||||
match *tuple {
|
||||
(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() {
|
||||
for ccx.stats.llvm_insns.iter().advance |(k, v)| {
|
||||
io::println(fmt!("%-7u %s", *v, *k));
|
||||
printfln!("%-7u %s", *v, *k);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,9 +654,9 @@ pub fn trans_call_inner(in_cx: @mut Block,
|
||||
|
||||
// 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| {
|
||||
io::println(fmt!("arg: %s", bcx.val_to_str(*llarg)));
|
||||
printfln!("arg: %s", bcx.val_to_str(*llarg));
|
||||
}
|
||||
io::println("---");
|
||||
*/
|
||||
|
@ -37,7 +37,6 @@ use util::ppaux::ty_to_short_str;
|
||||
|
||||
use middle::trans::type_::Type;
|
||||
|
||||
use std::io;
|
||||
use std::libc::c_uint;
|
||||
use std::str;
|
||||
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);
|
||||
|
||||
if ccx.sess.count_type_sizes() {
|
||||
io::println(fmt!("%u\t%s", llsize_of_real(ccx, llty),
|
||||
ppaux::ty_to_str(ccx.tcx, t)));
|
||||
printfln!("%u\t%s", llsize_of_real(ccx, llty),
|
||||
ppaux::ty_to_str(ccx.tcx, t));
|
||||
}
|
||||
|
||||
let llsize = llsize_of(ccx, llty);
|
||||
|
@ -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 {
|
||||
//io::println(fmt!("%?/%?", id, cx.node_types.len()));
|
||||
//printfln!("%?/%?", id, cx.node_types.len());
|
||||
match cx.node_types.find(&(id as uint)) {
|
||||
Some(&t) => t,
|
||||
None => cx.sess.bug(
|
||||
|
@ -128,28 +128,28 @@ pub fn version(argv0: &str) {
|
||||
let mut vers = ~"unknown version";
|
||||
let env_vers = env!("CFG_VERSION");
|
||||
if env_vers.len() != 0 { vers = env_vers.to_owned(); }
|
||||
io::println(fmt!("%s %s", argv0, vers));
|
||||
io::println(fmt!("host: %s", host_triple()));
|
||||
printfln!("%s %s", argv0, vers);
|
||||
printfln!("host: %s", host_triple());
|
||||
}
|
||||
|
||||
pub fn usage(argv0: &str) {
|
||||
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
|
||||
io::println(fmt!("%s\
|
||||
printfln!("%s\
|
||||
Additional help:
|
||||
-W help Print 'lint' options and default settings
|
||||
-Z help Print internal options for debugging rustc\n",
|
||||
groups::usage(message, optgroups())));
|
||||
groups::usage(message, optgroups()));
|
||||
}
|
||||
|
||||
pub fn describe_warnings() {
|
||||
use extra::sort::Sort;
|
||||
io::println(fmt!("
|
||||
printfln!("
|
||||
Available lint options:
|
||||
-W <foo> Warn about <foo>
|
||||
-A <foo> Allow <foo>
|
||||
-D <foo> Deny <foo>
|
||||
-F <foo> Forbid <foo> (deny, and deny all overrides)
|
||||
"));
|
||||
");
|
||||
|
||||
let lint_dict = lint::get_lint_dict();
|
||||
let mut lint_dict = lint_dict.consume()
|
||||
@ -164,28 +164,28 @@ Available lint options:
|
||||
fn padded(max: uint, s: &str) -> ~str {
|
||||
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
|
||||
}
|
||||
io::println(fmt!("\nAvailable lint checks:\n"));
|
||||
io::println(fmt!(" %s %7.7s %s",
|
||||
padded(max_key, "name"), "default", "meaning"));
|
||||
io::println(fmt!(" %s %7.7s %s\n",
|
||||
padded(max_key, "----"), "-------", "-------"));
|
||||
printfln!("\nAvailable lint checks:\n");
|
||||
printfln!(" %s %7.7s %s",
|
||||
padded(max_key, "name"), "default", "meaning");
|
||||
printfln!(" %s %7.7s %s\n",
|
||||
padded(max_key, "----"), "-------", "-------");
|
||||
for lint_dict.consume_iter().advance |(spec, name)| {
|
||||
let name = name.replace("_", "-");
|
||||
io::println(fmt!(" %s %7.7s %s",
|
||||
padded(max_key, name),
|
||||
lint::level_to_str(spec.default),
|
||||
spec.desc));
|
||||
printfln!(" %s %7.7s %s",
|
||||
padded(max_key, name),
|
||||
lint::level_to_str(spec.default),
|
||||
spec.desc);
|
||||
}
|
||||
io::println("");
|
||||
}
|
||||
|
||||
pub fn describe_debug_flags() {
|
||||
io::println(fmt!("\nAvailable debug options:\n"));
|
||||
printfln!("\nAvailable debug options:\n");
|
||||
let r = session::debugging_opts_map();
|
||||
for r.iter().advance |tuple| {
|
||||
match *tuple {
|
||||
(ref name, ref desc, _) => {
|
||||
io::println(fmt!(" -Z %-20s -- %s", *name, *desc));
|
||||
printfln!(" -Z %-20s -- %s", *name, *desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ use syntax::codemap::{span};
|
||||
use syntax::visit;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
use std::io;
|
||||
use extra;
|
||||
|
||||
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 rv = thunk();
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ pub fn usage() {
|
||||
println("Options:\n");
|
||||
let r = opts();
|
||||
for r.iter().advance |opt| {
|
||||
println(fmt!(" %s", opt.second()));
|
||||
printfln!(" %s", opt.second());
|
||||
}
|
||||
println("");
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ extern mod extra;
|
||||
extern mod rustc;
|
||||
extern mod syntax;
|
||||
|
||||
use std::io;
|
||||
use std::os;
|
||||
|
||||
use config::Config;
|
||||
@ -69,7 +68,7 @@ pub fn main() {
|
||||
let config = match config::parse_config(args) {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
io::println(fmt!("error: %s", err));
|
||||
printfln!("error: %s", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -334,7 +334,7 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
|
||||
None => { },
|
||||
}
|
||||
if (should_compile) {
|
||||
println(fmt!("compiling %s...", src_filename));
|
||||
printfln!("compiling %s...", src_filename);
|
||||
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
|
||||
Some(outputs));
|
||||
true
|
||||
@ -413,8 +413,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
|
||||
if loaded_crates.is_empty() {
|
||||
println("no crates loaded");
|
||||
} else {
|
||||
println(fmt!("crates loaded: %s",
|
||||
loaded_crates.connect(", ")));
|
||||
printfln!("crates loaded: %s", loaded_crates.connect(", "));
|
||||
}
|
||||
}
|
||||
~"{" => {
|
||||
|
@ -34,7 +34,7 @@ pub fn main() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ pub trait IteratorUtil<A> {
|
||||
/// use std::iterator::Counter;
|
||||
///
|
||||
/// for Counter::new(0, 10).advance |i| {
|
||||
/// io::println(fmt!("%d", i));
|
||||
/// printfln!("%d", i);
|
||||
/// }
|
||||
/// ~~~
|
||||
fn advance(&mut self, f: &fn(A) -> bool) -> bool;
|
||||
|
@ -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];
|
||||
///
|
||||
/// 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]);
|
||||
/// }
|
||||
/// ~~~
|
||||
///
|
||||
|
@ -28,7 +28,7 @@ use std::rand::RngUtil;
|
||||
fn main() {
|
||||
let mut rng = rand::rng();
|
||||
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 () {
|
||||
let tuple_ptr = rand::random::<~(f64, char)>();
|
||||
println(fmt!("%?", tuple_ptr))
|
||||
printfln!(tuple_ptr)
|
||||
}
|
||||
~~~
|
||||
*/
|
||||
@ -301,7 +301,7 @@ pub trait RngUtil {
|
||||
*
|
||||
* fn main() {
|
||||
* 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() {
|
||||
* 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() {
|
||||
* 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'},
|
||||
* rand::Weighted {weight: 2, item: 'b'},
|
||||
* 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'},
|
||||
* rand::Weighted {weight: 2, item: 'b'},
|
||||
* 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'},
|
||||
* rand::Weighted {weight: 2, item: 'b'},
|
||||
* 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() {
|
||||
* 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 y = [1,2,3];
|
||||
* rng.shuffle_mut(y);
|
||||
* println(fmt!("%?",y));
|
||||
* printfln!(y);
|
||||
* rng.shuffle_mut(y);
|
||||
* println(fmt!("%?",y));
|
||||
* printfln!(y);
|
||||
* }
|
||||
* ~~~
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ fn ziggurat<R:Rng>(rng: &mut R,
|
||||
///
|
||||
/// fn main() {
|
||||
/// 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);
|
||||
@ -124,7 +124,7 @@ impl Rand for StandardNormal {
|
||||
///
|
||||
/// fn main() {
|
||||
/// 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);
|
||||
|
@ -1727,7 +1727,7 @@ impl<'self> StrSlice<'self> for &'self str {
|
||||
* let i = 0u;
|
||||
* while i < s.len() {
|
||||
* let CharRange {ch, next} = s.char_range_at(i);
|
||||
* std::io::println(fmt!("%u: %c",i,ch));
|
||||
* printfln!("%u: %c", i, ch);
|
||||
* i = next;
|
||||
* }
|
||||
* ~~~
|
||||
|
@ -833,7 +833,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
|
||||
* ~~~ {.rust}
|
||||
* let v = &[1,2,3,4];
|
||||
* 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}
|
||||
* let v = &[1,2,3,4,5];
|
||||
* for v.chunk_iter().advance |win| {
|
||||
* io::println(fmt!("%?", win));
|
||||
* printfln!(win);
|
||||
* }
|
||||
* ~~~
|
||||
*
|
||||
|
@ -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 print;
|
||||
|
||||
use std::io;
|
||||
|
||||
pub fn add_new_extension(cx: @ExtCtxt,
|
||||
sp: span,
|
||||
name: ident,
|
||||
@ -82,11 +80,11 @@ pub fn add_new_extension(cx: @ExtCtxt,
|
||||
-> MacResult {
|
||||
|
||||
if cx.trace_macros() {
|
||||
io::println(fmt!("%s! { %s }",
|
||||
cx.str_of(name),
|
||||
print::pprust::tt_to_str(
|
||||
&ast::tt_delim(@mut arg.to_owned()),
|
||||
get_ident_interner())));
|
||||
printfln!("%s! { %s }",
|
||||
cx.str_of(name),
|
||||
print::pprust::tt_to_str(
|
||||
&ast::tt_delim(@mut arg.to_owned()),
|
||||
get_ident_interner()));
|
||||
}
|
||||
|
||||
// Which arm's failure should we report? (the one furthest along)
|
||||
|
@ -686,7 +686,7 @@ mod test {
|
||||
use std::io;
|
||||
#[test] fn t1() {
|
||||
let a = fresh_name("ghi");
|
||||
io::println(fmt!("interned name: %u,\ntextual name: %s\n",
|
||||
a,interner_get(a)));
|
||||
printfln!("interned name: %u,\ntextual name: %s\n",
|
||||
a, interner_get(a));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user