Skip to content

Remove printf #9550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/libextra/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'self> ToBase64 for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_base64(standard);
* printfln!("%s", str);
* println!("{}", str);
* }
* ```
*/
Expand Down Expand Up @@ -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);
* }
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
* ```
*/

Expand Down
2 changes: 1 addition & 1 deletion src/libextra/getopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
//! }
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'self> ToHex for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_hex();
* printfln!("%s", str);
* println!("{}", str);
* }
* ```
*/
Expand Down Expand Up @@ -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);
* }
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
8 changes: 4 additions & 4 deletions src/librust/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
22 changes: 11 additions & 11 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -3156,30 +3156,30 @@ 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);

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_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);

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
}
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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 12 additions & 12 deletions src/librustc/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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("");
}
Expand All @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/librusti/rusti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(", "));
}
}
~"{" => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ pub trait Iterator<A> {
/// use std::iter::count;
///
/// for i in count(0, 10) {
/// printfln!("%d", i);
/// println!("{}", i);
/// }
/// ```
#[inline]
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/rand/distributions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading