Skip to content

Commit 19c8c7a

Browse files
committed
Change 'print(fmt!(...))' to printf!/printfln! in src/lib*
1 parent 7a3eaf8 commit 19c8c7a

File tree

27 files changed

+103
-112
lines changed

27 files changed

+103
-112
lines changed

src/libextra/base64.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'self> ToBase64 for &'self [u8] {
7575
*
7676
* fn main () {
7777
* let str = [52,32].to_base64(standard);
78-
* println(fmt!("%s", str));
78+
* printfln!("%s", str);
7979
* }
8080
* ~~~
8181
*/
@@ -164,7 +164,7 @@ impl<'self> ToBase64 for &'self str {
164164
*
165165
* fn main () {
166166
* let str = "Hello, World".to_base64(standard);
167-
* println(fmt!("%s",str));
167+
* printfln!("%s", str);
168168
* }
169169
* ~~~
170170
*
@@ -194,9 +194,9 @@ impl<'self> FromBase64 for &'self [u8] {
194194
*
195195
* fn main () {
196196
* let str = [52,32].to_base64(standard);
197-
* println(fmt!("%s", str));
197+
* printfln!("%s", str);
198198
* let bytes = str.from_base64();
199-
* println(fmt!("%?",bytes));
199+
* printfln!("%?", bytes);
200200
* }
201201
* ~~~
202202
*/
@@ -271,11 +271,11 @@ impl<'self> FromBase64 for &'self str {
271271
*
272272
* fn main () {
273273
* let hello_str = "Hello, World".to_base64(standard);
274-
* println(fmt!("%s",hello_str));
274+
* printfln!("%s", hello_str);
275275
* let bytes = hello_str.from_base64();
276-
* println(fmt!("%?",bytes));
276+
* printfln!("%?", bytes);
277277
* let result_str = str::from_bytes(bytes);
278-
* println(fmt!("%s",result_str));
278+
* printfln!("%s", result_str);
279279
* }
280280
* ~~~
281281
*/

src/libextra/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* # fn make_a_sandwich() {};
2020
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
2121
* make_a_sandwich();
22-
* println(fmt!("fib(5000) = %?", delayed_fib.get()))
22+
* printfln!("fib(5000) = %?", delayed_fib.get())
2323
* ~~~
2424
*/
2525

src/libextra/getopts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* }
4545
*
4646
* fn print_usage(program: &str, _opts: &[Opt]) {
47-
* println(fmt!("Usage: %s [options]", program));
47+
* printfln!("Usage: %s [options]", program);
4848
* println("-o\t\tOutput");
4949
* println("-h --help\tUsage");
5050
* }

src/libextra/task_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ fn test_task_pool() {
103103
};
104104
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
105105
for 8.times {
106-
pool.execute(|i| println(fmt!("Hello from thread %u!", *i)));
106+
pool.execute(|i| printfln!("Hello from thread %u!", *i));
107107
}
108108
}

src/libextra/treemap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ mod test_set {
12001200

12011201
let mut n = 0;
12021202
for m.iter().advance |x| {
1203-
println(fmt!("%?", x));
1203+
printfln!(x);
12041204
assert_eq!(*x, n);
12051205
n += 1
12061206
}

src/librust/rust.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
132132
match find_cmd(command_string) {
133133
Some(command) => {
134134
match command.action {
135-
CallMain(prog, _) => io::println(fmt!(
135+
CallMain(prog, _) => printfln!(
136136
"The %s command is an alias for the %s program.",
137-
command.cmd, prog)),
137+
command.cmd, prog),
138138
_ => ()
139139
}
140140
match command.usage_full {
141-
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
141+
UsgStr(msg) => printfln!("%s\n", msg),
142142
UsgCall(f) => f(),
143143
}
144144
Valid(0)
@@ -211,8 +211,7 @@ fn usage() {
211211

212212
for COMMANDS.iter().advance |command| {
213213
let padding = " ".repeat(INDENT - command.cmd.len());
214-
io::println(fmt!(" %s%s%s",
215-
command.cmd, padding, command.usage_line));
214+
printfln!(" %s%s%s", command.cmd, padding, command.usage_line);
216215
}
217216

218217
io::print(

src/librustc/back/passes.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ pub fn list_passes() {
191191

192192
io::println("\nAnalysis Passes:");
193193
for analysis_passes.iter().advance |&(name, desc)| {
194-
io::println(fmt!(" %-30s -- %s", name, desc));
194+
printfln!(" %-30s -- %s", name, desc);
195195
}
196196
io::println("\nTransformation Passes:");
197197
for transform_passes.iter().advance |&(name, desc)| {
198-
io::println(fmt!(" %-30s -- %s", name, desc));
198+
printfln!(" %-30s -- %s", name, desc);
199199
}
200200
io::println("\nUtility Passes:");
201201
for utility_passes.iter().advance |&(name, desc)| {
202-
io::println(fmt!(" %-30s -- %s", name, desc));
202+
printfln!(" %-30s -- %s", name, desc);
203203
}
204204
}
205205

@@ -344,7 +344,7 @@ fn passes_exist() {
344344
if failed.len() > 0 {
345345
io::println("Some passes don't exist:");
346346
for failed.iter().advance |&n| {
347-
io::println(fmt!(" %s", n));
347+
printfln!(" %s", n);
348348
}
349349
fail!();
350350
}

src/librustc/metadata/encoder.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1624,16 +1624,16 @@ pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
16241624
}
16251625

16261626
io::println("metadata stats:");
1627-
io::println(fmt!(" inline bytes: %u", ecx.stats.inline_bytes));
1628-
io::println(fmt!(" attribute bytes: %u", ecx.stats.attr_bytes));
1629-
io::println(fmt!(" dep bytes: %u", ecx.stats.dep_bytes));
1630-
io::println(fmt!(" lang item bytes: %u", ecx.stats.lang_item_bytes));
1631-
io::println(fmt!(" link args bytes: %u", ecx.stats.link_args_bytes));
1632-
io::println(fmt!(" misc bytes: %u", ecx.stats.misc_bytes));
1633-
io::println(fmt!(" item bytes: %u", ecx.stats.item_bytes));
1634-
io::println(fmt!(" index bytes: %u", ecx.stats.index_bytes));
1635-
io::println(fmt!(" zero bytes: %u", ecx.stats.zero_bytes));
1636-
io::println(fmt!(" total bytes: %u", ecx.stats.total_bytes));
1627+
printfln!(" inline bytes: %u", ecx.stats.inline_bytes);
1628+
printfln!(" attribute bytes: %u", ecx.stats.attr_bytes);
1629+
printfln!(" dep bytes: %u", ecx.stats.dep_bytes);
1630+
printfln!(" lang item bytes: %u", ecx.stats.lang_item_bytes);
1631+
printfln!(" link args bytes: %u", ecx.stats.link_args_bytes);
1632+
printfln!(" misc bytes: %u", ecx.stats.misc_bytes);
1633+
printfln!(" item bytes: %u", ecx.stats.item_bytes);
1634+
printfln!(" index bytes: %u", ecx.stats.index_bytes);
1635+
printfln!(" zero bytes: %u", ecx.stats.zero_bytes);
1636+
printfln!(" total bytes: %u", ecx.stats.total_bytes);
16371637
}
16381638

16391639
// Pad this, since something (LLVM, presumably) is cutting off the

src/librustc/middle/borrowck/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ pub fn check_crate(
9393

9494
if tcx.sess.borrowck_stats() {
9595
io::println("--- borrowck stats ---");
96-
io::println(fmt!("paths requiring guarantees: %u",
97-
bccx.stats.guaranteed_paths));
98-
io::println(fmt!("paths requiring loans : %s",
99-
make_stat(bccx, bccx.stats.loaned_paths_same)));
100-
io::println(fmt!("paths requiring imm loans : %s",
101-
make_stat(bccx, bccx.stats.loaned_paths_imm)));
102-
io::println(fmt!("stable paths : %s",
103-
make_stat(bccx, bccx.stats.stable_paths)));
104-
io::println(fmt!("paths requiring purity : %s",
105-
make_stat(bccx, bccx.stats.req_pure_paths)));
96+
printfln!("paths requiring guarantees: %u",
97+
bccx.stats.guaranteed_paths);
98+
printfln!("paths requiring loans : %s",
99+
make_stat(bccx, bccx.stats.loaned_paths_same));
100+
printfln!("paths requiring imm loans : %s",
101+
make_stat(bccx, bccx.stats.loaned_paths_imm));
102+
printfln!("stable paths : %s",
103+
make_stat(bccx, bccx.stats.stable_paths));
104+
printfln!("paths requiring purity : %s",
105+
make_stat(bccx, bccx.stats.req_pure_paths));
106106
}
107107

108108
return (bccx.root_map, bccx.write_guard_map);

src/librustc/middle/trans/base.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -2999,32 +2999,30 @@ pub fn trans_crate(sess: session::Session,
29992999
write_metadata(ccx, crate);
30003000
if ccx.sess.trans_stats() {
30013001
io::println("--- trans stats ---");
3002-
io::println(fmt!("n_static_tydescs: %u",
3003-
ccx.stats.n_static_tydescs));
3004-
io::println(fmt!("n_glues_created: %u",
3005-
ccx.stats.n_glues_created));
3006-
io::println(fmt!("n_null_glues: %u", ccx.stats.n_null_glues));
3007-
io::println(fmt!("n_real_glues: %u", ccx.stats.n_real_glues));
3008-
3009-
io::println(fmt!("n_fns: %u", ccx.stats.n_fns));
3010-
io::println(fmt!("n_monos: %u", ccx.stats.n_monos));
3011-
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines));
3012-
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
3002+
printfln!("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
3003+
printfln!("n_glues_created: %u", ccx.stats.n_glues_created);
3004+
printfln!("n_null_glues: %u", ccx.stats.n_null_glues);
3005+
printfln!("n_real_glues: %u", ccx.stats.n_real_glues);
3006+
3007+
printfln!("n_fns: %u", ccx.stats.n_fns);
3008+
printfln!("n_monos: %u", ccx.stats.n_monos);
3009+
printfln!("n_inlines: %u", ccx.stats.n_inlines);
3010+
printfln!("n_closures: %u", ccx.stats.n_closures);
30133011
io::println("fn stats:");
30143012
do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| {
30153013
insns_a > insns_b
30163014
}
30173015
for ccx.stats.fn_stats.iter().advance |tuple| {
30183016
match *tuple {
30193017
(ref name, ms, insns) => {
3020-
io::println(fmt!("%u insns, %u ms, %s", insns, ms, *name));
3018+
printfln!("%u insns, %u ms, %s", insns, ms, *name);
30213019
}
30223020
}
30233021
}
30243022
}
30253023
if ccx.sess.count_llvm_insns() {
30263024
for ccx.stats.llvm_insns.iter().advance |(k, v)| {
3027-
io::println(fmt!("%-7u %s", *v, *k));
3025+
printfln!("%-7u %s", *v, *k);
30283026
}
30293027
}
30303028

src/librustc/middle/trans/callee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,9 @@ pub fn trans_call_inner(in_cx: block,
654654

655655
// Uncomment this to debug calls.
656656
/*
657-
io::println(fmt!("calling: %s", bcx.val_to_str(llfn)));
657+
printfln!("calling: %s", bcx.val_to_str(llfn));
658658
for llargs.iter().advance |llarg| {
659-
io::println(fmt!("arg: %s", bcx.val_to_str(*llarg)));
659+
printfln!("arg: %s", bcx.val_to_str(*llarg));
660660
}
661661
io::println("---");
662662
*/

src/librustc/middle/trans/glue.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use util::ppaux::ty_to_short_str;
3737

3838
use middle::trans::type_::Type;
3939

40-
use std::io;
4140
use std::libc::c_uint;
4241
use std::str;
4342
use syntax::ast;
@@ -649,8 +648,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
649648
let llty = type_of(ccx, t);
650649

651650
if ccx.sess.count_type_sizes() {
652-
io::println(fmt!("%u\t%s", llsize_of_real(ccx, llty),
653-
ppaux::ty_to_str(ccx.tcx, t)));
651+
printfln!("%u\t%s", llsize_of_real(ccx, llty),
652+
ppaux::ty_to_str(ccx.tcx, t));
654653
}
655654

656655
let llsize = llsize_of(ccx, llty);

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2712,7 +2712,7 @@ pub fn node_id_to_trait_ref(cx: ctxt, id: ast::node_id) -> @ty::TraitRef {
27122712
}
27132713

27142714
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
2715-
//io::println(fmt!("%?/%?", id, cx.node_types.len()));
2715+
//printfln!("%?/%?", id, cx.node_types.len());
27162716
match cx.node_types.find(&(id as uint)) {
27172717
Some(&t) => t,
27182718
None => cx.sess.bug(

src/librustc/rustc.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,28 @@ pub fn version(argv0: &str) {
128128
let mut vers = ~"unknown version";
129129
let env_vers = env!("CFG_VERSION");
130130
if env_vers.len() != 0 { vers = env_vers.to_owned(); }
131-
io::println(fmt!("%s %s", argv0, vers));
132-
io::println(fmt!("host: %s", host_triple()));
131+
printfln!("%s %s", argv0, vers);
132+
printfln!("host: %s", host_triple());
133133
}
134134

135135
pub fn usage(argv0: &str) {
136136
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
137-
io::println(fmt!("%s\
137+
printfln!("%s\
138138
Additional help:
139139
-W help Print 'lint' options and default settings
140140
-Z help Print internal options for debugging rustc\n",
141-
groups::usage(message, optgroups())));
141+
groups::usage(message, optgroups()));
142142
}
143143

144144
pub fn describe_warnings() {
145145
use extra::sort::Sort;
146-
io::println(fmt!("
146+
printfln!("
147147
Available lint options:
148148
-W <foo> Warn about <foo>
149149
-A <foo> Allow <foo>
150150
-D <foo> Deny <foo>
151151
-F <foo> Forbid <foo> (deny, and deny all overrides)
152-
"));
152+
");
153153

154154
let lint_dict = lint::get_lint_dict();
155155
let mut lint_dict = lint_dict.consume()
@@ -164,28 +164,28 @@ Available lint options:
164164
fn padded(max: uint, s: &str) -> ~str {
165165
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
166166
}
167-
io::println(fmt!("\nAvailable lint checks:\n"));
168-
io::println(fmt!(" %s %7.7s %s",
169-
padded(max_key, "name"), "default", "meaning"));
170-
io::println(fmt!(" %s %7.7s %s\n",
171-
padded(max_key, "----"), "-------", "-------"));
167+
printfln!("\nAvailable lint checks:\n");
168+
printfln!(" %s %7.7s %s",
169+
padded(max_key, "name"), "default", "meaning");
170+
printfln!(" %s %7.7s %s\n",
171+
padded(max_key, "----"), "-------", "-------");
172172
for lint_dict.consume_iter().advance |(spec, name)| {
173173
let name = name.replace("_", "-");
174-
io::println(fmt!(" %s %7.7s %s",
175-
padded(max_key, name),
176-
lint::level_to_str(spec.default),
177-
spec.desc));
174+
printfln!(" %s %7.7s %s",
175+
padded(max_key, name),
176+
lint::level_to_str(spec.default),
177+
spec.desc);
178178
}
179179
io::println("");
180180
}
181181

182182
pub fn describe_debug_flags() {
183-
io::println(fmt!("\nAvailable debug options:\n"));
183+
printfln!("\nAvailable debug options:\n");
184184
let r = session::debugging_opts_map();
185185
for r.iter().advance |tuple| {
186186
match *tuple {
187187
(ref name, ref desc, _) => {
188-
io::println(fmt!(" -Z %-20s -- %s", *name, *desc));
188+
printfln!(" -Z %-20s -- %s", *name, *desc);
189189
}
190190
}
191191
}

src/librustc/util/common.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ use syntax::codemap::{span};
1414
use syntax::visit;
1515

1616
use std::hashmap::HashSet;
17-
use std::io;
1817
use extra;
1918

2019
pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
2120
if !do_it { return thunk(); }
2221
let start = extra::time::precise_time_s();
2322
let rv = thunk();
2423
let end = extra::time::precise_time_s();
25-
io::println(fmt!("time: %3.3f s\t%s", end - start, what));
24+
printfln!("time: %3.3f s\t%s", end - start, what);
2625
rv
2726
}
2827

src/librustdoc/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn usage() {
7474
println("Options:\n");
7575
let r = opts();
7676
for r.iter().advance |opt| {
77-
println(fmt!(" %s", opt.second()));
77+
printfln!(" %s", opt.second());
7878
}
7979
println("");
8080
}

src/librustdoc/rustdoc.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ extern mod extra;
2323
extern mod rustc;
2424
extern mod syntax;
2525

26-
use std::io;
2726
use std::os;
2827

2928
use config::Config;
@@ -69,7 +68,7 @@ pub fn main() {
6968
let config = match config::parse_config(args) {
7069
Ok(config) => config,
7170
Err(err) => {
72-
io::println(fmt!("error: %s", err));
71+
printfln!("error: %s", err);
7372
return;
7473
}
7574
};

0 commit comments

Comments
 (0)