auto merge of #11416 : bjz/rust/remove-print-fns, r=alexcrichton
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
This commit is contained in:
commit
a34727f276
130 changed files with 350 additions and 336 deletions
|
|
@ -20,6 +20,6 @@ pub struct Bar {
|
|||
impl Foo for Bar {
|
||||
#[inline(always)]
|
||||
fn f(&self) {
|
||||
println((*self).x);
|
||||
println!("{}", (*self).x);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct S {
|
|||
|
||||
impl Drop for S {
|
||||
fn drop(&mut self) {
|
||||
println("goodbye");
|
||||
println!("goodbye");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fn timed(label: &str, f: ||) {
|
|||
}
|
||||
|
||||
fn ascending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
|
||||
println(" Ascending integers:");
|
||||
println!(" Ascending integers:");
|
||||
|
||||
timed("insert", || {
|
||||
for i in range(0u, n_keys) {
|
||||
|
|
@ -49,7 +49,7 @@ fn ascending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
|
|||
}
|
||||
|
||||
fn descending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
|
||||
println(" Descending integers:");
|
||||
println!(" Descending integers:");
|
||||
|
||||
timed("insert", || {
|
||||
for i in range(0, n_keys).invert() {
|
||||
|
|
@ -115,7 +115,8 @@ fn main() {
|
|||
|
||||
println!("{} keys", n_keys);
|
||||
|
||||
println("\nTreeMap:");
|
||||
// FIXME: #9970
|
||||
println!("{}", "\nTreeMap:");
|
||||
|
||||
{
|
||||
let mut map: TreeMap<uint,uint> = TreeMap::new();
|
||||
|
|
@ -128,12 +129,13 @@ fn main() {
|
|||
}
|
||||
|
||||
{
|
||||
println(" Random integers:");
|
||||
println!(" Random integers:");
|
||||
let mut map: TreeMap<uint,uint> = TreeMap::new();
|
||||
vector(&mut map, n_keys, rand);
|
||||
}
|
||||
|
||||
println("\nHashMap:");
|
||||
// FIXME: #9970
|
||||
println!("{}", "\nHashMap:");
|
||||
|
||||
{
|
||||
let mut map: HashMap<uint,uint> = HashMap::new();
|
||||
|
|
@ -146,12 +148,13 @@ fn main() {
|
|||
}
|
||||
|
||||
{
|
||||
println(" Random integers:");
|
||||
println!(" Random integers:");
|
||||
let mut map: HashMap<uint,uint> = HashMap::new();
|
||||
vector(&mut map, n_keys, rand);
|
||||
}
|
||||
|
||||
println("\nTrieMap:");
|
||||
// FIXME: #9970
|
||||
println!("{}", "\nTrieMap:");
|
||||
|
||||
{
|
||||
let mut map: TrieMap<uint> = TrieMap::new();
|
||||
|
|
@ -164,7 +167,7 @@ fn main() {
|
|||
}
|
||||
|
||||
{
|
||||
println(" Random integers:");
|
||||
println!(" Random integers:");
|
||||
let mut map: TrieMap<uint> = TrieMap::new();
|
||||
vector(&mut map, n_keys, rand);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ impl Results {
|
|||
}
|
||||
|
||||
fn write_header(header: &str) {
|
||||
println(header);
|
||||
println!("{}", header);
|
||||
}
|
||||
|
||||
fn write_row(label: &str, value: f64) {
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ fn main() {
|
|||
|
||||
for y in range(0, 256) {
|
||||
for x in range(0, 256) {
|
||||
print(symbols[(pixels[y*256+x] / 0.2f32) as int]);
|
||||
print!("{}", symbols[(pixels[y*256+x] / 0.2f32) as int]);
|
||||
}
|
||||
println("");
|
||||
println!("");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ fn main() {
|
|||
}).to_owned_vec();
|
||||
|
||||
for message in messages.mut_iter() {
|
||||
println(*message.get_ref());
|
||||
println!("{}", *message.get_ref());
|
||||
}
|
||||
|
||||
println!("long lived tree of depth {}\t check: {}",
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ fn print_complements() {
|
|||
let all = [Blue, Red, Yellow];
|
||||
for aa in all.iter() {
|
||||
for bb in all.iter() {
|
||||
println(show_color(*aa) + " + " + show_color(*bb) +
|
||||
" -> " + show_color(transform(*aa, *bb)));
|
||||
println!("{} + {} -> {}", show_color(*aa), show_color(*bb),
|
||||
show_color(transform(*aa, *bb)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,15 +187,15 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
}
|
||||
|
||||
// print each color in the set
|
||||
println(show_color_list(set));
|
||||
println!("{}", show_color_list(set));
|
||||
|
||||
// print each creature's stats
|
||||
for rep in report.iter() {
|
||||
println(*rep);
|
||||
println!("{}", *rep);
|
||||
}
|
||||
|
||||
// print the total number of creatures met
|
||||
println(show_number(creatures_met));
|
||||
println!("{}", show_number(creatures_met));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
@ -211,10 +211,10 @@ fn main() {
|
|||
let nn = from_str::<uint>(args[1]).unwrap();
|
||||
|
||||
print_complements();
|
||||
println("");
|
||||
println!("");
|
||||
|
||||
rendezvous(nn, ~[Blue, Red, Yellow]);
|
||||
println("");
|
||||
println!("");
|
||||
|
||||
rendezvous(nn,
|
||||
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ fn fannkuch_redux(n: i32) -> i32 {
|
|||
// Use incremental change to generate another permutation.
|
||||
loop {
|
||||
if r == n {
|
||||
println(checksum.to_str());
|
||||
println!("{}", checksum);
|
||||
return max_flips_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,6 +223,6 @@ fn main() {
|
|||
|
||||
// now fetch and print result messages
|
||||
for (ii, _sz) in sizes.iter().enumerate() {
|
||||
println(from_child[ii].recv());
|
||||
println!("{}", from_child[ii].recv());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ static LIMIT: f64 = 2.0;
|
|||
fn main() {
|
||||
let args = std::os::args();
|
||||
let (w, mut out) = if args.len() < 2 {
|
||||
println("Test mode: do not dump the image because it's not utf8, \
|
||||
which interferes with the test runner.");
|
||||
println!("Test mode: do not dump the image because it's not utf8, \
|
||||
which interferes with the test runner.");
|
||||
(1000, ~DummyWriter as ~Writer)
|
||||
} else {
|
||||
(from_str(args[1]).unwrap(),
|
||||
|
|
|
|||
|
|
@ -193,11 +193,11 @@ fn to_utf8(raw_sol: &List<u64>) -> ~str {
|
|||
// Prints a solution in ~str form.
|
||||
fn print_sol(sol: &str) {
|
||||
for (i, c) in sol.chars().enumerate() {
|
||||
if (i) % 5 == 0 {println("");}
|
||||
if (i + 5) % 10 == 0 {print(" ");}
|
||||
if (i) % 5 == 0 { println!(""); }
|
||||
if (i + 5) % 10 == 0 { print!(" "); }
|
||||
print!("{} ", c);
|
||||
}
|
||||
println("");
|
||||
println!("");
|
||||
}
|
||||
|
||||
// The data managed during the search
|
||||
|
|
@ -277,5 +277,5 @@ fn main () {
|
|||
println!("{} solutions found", data.nb);
|
||||
print_sol(data.min);
|
||||
print_sol(data.max);
|
||||
println("");
|
||||
println!("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ fn pidigits(n: int) {
|
|||
|
||||
let m = n % 10;
|
||||
if m != 0 {
|
||||
for _ in range(m, 10) {print(" ");}
|
||||
for _ in range(m, 10) { print!(" "); }
|
||||
print!("\t:{}\n", n);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ enum Either<T, U> { Left(T), Right(U) }
|
|||
|
||||
fn g() {
|
||||
let mut x: Either<int,f64> = Left(3);
|
||||
println(f(&mut x, &x).to_str()); //~ ERROR cannot borrow
|
||||
println!("{}", f(&mut x, &x)); //~ ERROR cannot borrow
|
||||
}
|
||||
|
||||
fn h() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
struct S {f:~str}
|
||||
impl Drop for S {
|
||||
fn drop(&mut self) { println(self.f); }
|
||||
fn drop(&mut self) { println!("{}", self.f); }
|
||||
}
|
||||
|
||||
fn move_in_match() {
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ fn main() {
|
|||
},
|
||||
None => { fail!() }
|
||||
}
|
||||
println(*msg);
|
||||
println!("{}", *msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ fn main() {
|
|||
};
|
||||
match &s.x {
|
||||
&Foo => {}
|
||||
&Bar(ref identifier) => println(*identifier)
|
||||
&Bar(ref identifier) => println!("{}", *identifier)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
mod circular_modules_main;
|
||||
|
||||
pub fn say_hello() {
|
||||
println(circular_modules_main::hi_str());
|
||||
println!("{}", circular_modules_main::hi_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn call_bare(f: fn(&str)) {
|
|||
|
||||
fn main() {
|
||||
let string = "world!";
|
||||
let f: |&str| = |s| println(s + string);
|
||||
let f: |&str| = |s| println!("{}", s + string);
|
||||
call_bare(f) //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type Foo = @[u8];
|
|||
impl Drop for Foo { //~ ERROR the Drop trait may only be implemented
|
||||
//~^ ERROR cannot provide an extension implementation
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
println!("kaboom");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
println!("kaboom");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ trait Bar : Drop {
|
|||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
println!("kaboom");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use extra::arc::Arc;
|
|||
struct A { y: Arc<int>, x: Arc<int> }
|
||||
|
||||
impl Drop for A {
|
||||
fn drop(&mut self) { println(format!("x={:?}", self.x.get())); }
|
||||
fn drop(&mut self) { println!("x={:?}", self.x.get()); }
|
||||
}
|
||||
fn main() {
|
||||
let a = A { y: Arc::new(1), x: Arc::new(2) };
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ impl<'self> Serializable<str> for &'self str {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
println("hello");
|
||||
println!("hello");
|
||||
let x = ~"foo";
|
||||
let y = x;
|
||||
println(y);
|
||||
println!("{}", y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ struct foo {
|
|||
impl Drop for foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
println("Goodbye, World!");
|
||||
println!("Goodbye, World!");
|
||||
self.x.set(self.x.get() + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ impl Eq for Lol {
|
|||
|
||||
fn main() {
|
||||
if Lol(2) == Lol(4) {
|
||||
println("2 == 4");
|
||||
println!("2 == 4");
|
||||
} else {
|
||||
println("2 != 4");
|
||||
println!("2 != 4");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ impl ToStr for Point { //~ ERROR implements a method not defined in the trait
|
|||
|
||||
fn main() {
|
||||
let p = Point::new(0.0f, 0.0f);
|
||||
io::println(p.to_str());
|
||||
println!("{}", p.to_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@
|
|||
|
||||
macro_rules! print_hd_tl (
|
||||
($field_hd:ident, $($field_tl:ident),+) => ({
|
||||
print(stringify!($field)); //~ ERROR unknown macro variable
|
||||
print("::[");
|
||||
print!("{}", stringify!($field)); //~ ERROR unknown macro variable
|
||||
print!("::[");
|
||||
$(
|
||||
print(stringify!($field_tl));
|
||||
print(", ");
|
||||
print!("{}", stringify!($field_tl));
|
||||
print!(", ");
|
||||
)+
|
||||
print("]\n");
|
||||
// FIXME: #9970
|
||||
print!("{}", "]\n");
|
||||
})
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn main() {
|
|||
}
|
||||
|
||||
match ~[~"foo", ~"bar", ~"baz"] {
|
||||
[a, _, _, ..] => { println(a); }
|
||||
[a, _, _, ..] => { println!("{}", a); }
|
||||
[~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
|
||||
_ => { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ fn main() {
|
|||
f(&s, |hellothere| {
|
||||
match hellothere.x {
|
||||
~Foo(_) => {}
|
||||
~Bar(x) => println(x.to_str()), //~ ERROR cannot move out
|
||||
~Bar(x) => println!("{}", x.to_str()), //~ ERROR cannot move out
|
||||
~Baz => {}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::task;
|
|||
fn main() {
|
||||
let x = ~"Hello world!";
|
||||
do task::spawn {
|
||||
println(x);
|
||||
println!("{}", x);
|
||||
}
|
||||
println(x); //~ ERROR use of moved value
|
||||
println!("{}", x); //~ ERROR use of moved value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ mod foo {
|
|||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
|
||||
fn foo() {
|
||||
print("foo"); //~ ERROR: unresolved name
|
||||
println("bar"); //~ ERROR: unresolved name
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +37,7 @@ mod foo {
|
|||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
|
||||
fn foo() {
|
||||
print("foo"); //~ ERROR: unresolved name
|
||||
println("bar"); //~ ERROR: unresolved name
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,8 +52,7 @@ fn qux() {
|
|||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
|
||||
fn foo() {
|
||||
print("foo"); //~ ERROR: unresolved name
|
||||
println("bar"); //~ ERROR: unresolved name
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +60,5 @@ fn qux() {
|
|||
|
||||
fn main() {
|
||||
// these should work fine
|
||||
print("foo");
|
||||
println("bar");
|
||||
drop(2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,5 @@ impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
|||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
|
||||
fn main() {
|
||||
print("foo"); //~ ERROR: unresolved name
|
||||
println("bar"); //~ ERROR: unresolved name
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let f = |3: int| println("hello"); //~ ERROR refutable pattern
|
||||
let f = |3: int| println!("hello"); //~ ERROR refutable pattern
|
||||
f(4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct Foo {
|
|||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
println("Goodbye!");
|
||||
println!("Goodbye!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
enum E {}
|
||||
|
||||
fn f(e: E) {
|
||||
println((e as int).to_str()); //~ ERROR non-scalar cast
|
||||
println!("{}", (e as int).to_str()); //~ ERROR non-scalar cast
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ impl Drop for Bar {
|
|||
|
||||
impl Foo for Bar {
|
||||
fn f(&self) {
|
||||
println("hi");
|
||||
println!("hi");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
fn main() {
|
||||
let x = ~"Hello!";
|
||||
let _y = x;
|
||||
println(x); //~ ERROR use of moved value
|
||||
println!("{}", x); //~ ERROR use of moved value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ impl S {
|
|||
|
||||
fn main() {
|
||||
let x = S { x: 1 };
|
||||
println(x.foo().to_str());
|
||||
println!("{}", x.foo());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ impl S {
|
|||
|
||||
fn main() {
|
||||
let x = S { x: ~1 };
|
||||
println(x.foo().to_str());
|
||||
println!("{}", x.foo());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ fn assignment(mut a: u64, b: u64, c: f64) {
|
|||
}
|
||||
|
||||
fn function_call(x: u64, y: u64, z: f64) {
|
||||
print("Hi!")
|
||||
std::io::stdio::print("Hi!")
|
||||
}
|
||||
|
||||
fn identifier(x: u64, y: u64, z: f64) -> u64 {
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ fn assignment(mut a: u64, b: u64, c: f64) {
|
|||
|
||||
#[no_split_stack]
|
||||
fn function_call(x: u64, y: u64, z: f64) {
|
||||
print("Hi!")
|
||||
std::io::stdio::print("Hi!")
|
||||
}
|
||||
|
||||
#[no_split_stack]
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ impl Foo {
|
|||
|
||||
pub fn main() {
|
||||
let x = Foo::new();
|
||||
println(x.x.to_str());
|
||||
println!("{}", x.x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ use anon_trait_static_method_lib::Foo;
|
|||
|
||||
pub fn main() {
|
||||
let x = Foo::new();
|
||||
println(x.x.to_str());
|
||||
println!("{}", x.x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ impl<T:Baz> Foo for T {
|
|||
|
||||
impl Baz for Bar {
|
||||
fn g(&self) {
|
||||
println(self.x.to_str());
|
||||
println!("{}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
pub fn main() {
|
||||
let x: &'static str = "foo";
|
||||
println(x);
|
||||
println!("{}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ trait Foo {
|
|||
|
||||
impl Foo for int {
|
||||
fn foo(@self) {
|
||||
println("Hello world!");
|
||||
println!("Hello world!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
use std::cast;
|
||||
use std::io::stdio::println;
|
||||
|
||||
fn call_it(f: proc(~str) -> ~str) {
|
||||
println(f(~"Fred"))
|
||||
println!("{}", f(~"Fred"))
|
||||
}
|
||||
|
||||
fn call_a_thunk(f: ||) {
|
||||
|
|
@ -57,9 +58,9 @@ pub fn main() {
|
|||
|
||||
// Closures
|
||||
|
||||
call_a_thunk(|| println("Hello world!"));
|
||||
call_a_thunk(|| println!("Hello world!"));
|
||||
|
||||
call_this(|s| println(s));
|
||||
call_this(|s| println!("{}", s));
|
||||
|
||||
call_that(|x, y| *x + *y);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
trait Foo {
|
||||
fn f(&self) {
|
||||
println("Hello!");
|
||||
println!("Hello!");
|
||||
self.g();
|
||||
}
|
||||
fn g(&self);
|
||||
|
|
@ -23,7 +23,7 @@ struct A {
|
|||
|
||||
impl Foo for A {
|
||||
fn g(&self) {
|
||||
println("Goodbye!");
|
||||
println!("Goodbye!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct S<T> {
|
|||
#[unsafe_destructor]
|
||||
impl<T> ::std::ops::Drop for S<T> {
|
||||
fn drop(&mut self) {
|
||||
println("bye");
|
||||
println!("bye");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
println("bye");
|
||||
println!("bye");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
pub fn main() {
|
||||
let v: ~[int] = ~[ 1, ..5 ];
|
||||
println(v[0].to_str());
|
||||
println(v[1].to_str());
|
||||
println(v[2].to_str());
|
||||
println(v[3].to_str());
|
||||
println(v[4].to_str());
|
||||
println!("{}", v[0]);
|
||||
println!("{}", v[1]);
|
||||
println!("{}", v[2]);
|
||||
println!("{}", v[3]);
|
||||
println!("{}", v[4]);
|
||||
let v: @[int] = @[ 2, ..5 ];
|
||||
println(v[0].to_str());
|
||||
println(v[1].to_str());
|
||||
println(v[2].to_str());
|
||||
println(v[3].to_str());
|
||||
println(v[4].to_str());
|
||||
println!("{}", v[0]);
|
||||
println!("{}", v[1]);
|
||||
println!("{}", v[2]);
|
||||
println!("{}", v[3]);
|
||||
println!("{}", v[4]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ extern mod extra;
|
|||
use extra::json::Object;
|
||||
|
||||
pub fn main() {
|
||||
println("Hello world!");
|
||||
println!("Hello world!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ struct S {
|
|||
|
||||
pub fn main() {
|
||||
let x: f32 = 4.0;
|
||||
println(x.to_str());
|
||||
println!("{}", x);
|
||||
let y: f64 = 64.0;
|
||||
println(y.to_str());
|
||||
println!("{}", y);
|
||||
let z = S { z: 1.0 };
|
||||
println(z.z.to_str());
|
||||
println!("{}", z.z);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
pub fn main() {
|
||||
let v : &[(int,int)] = &[ (1, 2), (3, 4), (5, 6) ];
|
||||
for &(x, y) in v.iter() {
|
||||
println(y.to_str());
|
||||
println(x.to_str());
|
||||
println!("{}", y);
|
||||
println!("{}", x);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
println("hello, world");
|
||||
println!("hello, world");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ extern mod impl_privacy_xc_2;
|
|||
pub fn main() {
|
||||
let fish1 = impl_privacy_xc_2::Fish { x: 1 };
|
||||
let fish2 = impl_privacy_xc_2::Fish { x: 2 };
|
||||
println(if fish1.eq(&fish2) { "yes" } else { "no " });
|
||||
if fish1.eq(&fish2) { println!("yes") } else { println!("no") };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct trie_node {
|
|||
|
||||
fn print_str_vector(vector: ~[~str]) {
|
||||
for string in vector.iter() {
|
||||
println(*string);
|
||||
println!("{}", *string);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ pub fn main() {
|
|||
element: S,
|
||||
next: None
|
||||
};
|
||||
println(ls.element);
|
||||
println!("{}", ls.element);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub fn main() {
|
|||
}
|
||||
|
||||
fn to_string(t: @Text) {
|
||||
println(t.to_str());
|
||||
println!("{}", t.to_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ pub fn main() {
|
|||
buildings::Tower { height: h } => { h }
|
||||
};
|
||||
|
||||
println(h.to_str());
|
||||
println!("{}", h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,20 +13,20 @@
|
|||
*/
|
||||
|
||||
fn print1(b: bool, s1: &str, s2: &str) {
|
||||
println(if b { s1 } else { s2 });
|
||||
println!("{}", if b { s1 } else { s2 });
|
||||
}
|
||||
fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
|
||||
println(if b { s1 } else { s2 });
|
||||
println!("{}", if b { s1 } else { s2 });
|
||||
}
|
||||
fn print3(b: bool, s1: &str, s2: &str) {
|
||||
let mut s: &str;
|
||||
if b { s = s1; } else { s = s2; }
|
||||
println(s);
|
||||
println!("{}", s);
|
||||
}
|
||||
fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
|
||||
let mut s: &str;
|
||||
if b { s = s1; } else { s = s2; }
|
||||
println(s);
|
||||
println!("{}", s);
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ priv fn cmd_to_str(cmd: ~[~str]) -> ~str {
|
|||
|
||||
fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result {
|
||||
let cmd = cmd_to_str(cmd);
|
||||
//io::println(cmd);
|
||||
//println!("{}", cmd);
|
||||
sb.write_str(cmd);
|
||||
let res = parse_response(@sb as @io::Reader);
|
||||
res
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::io::println;
|
||||
|
||||
pub fn main() {
|
||||
let (port, chan) = Chan::new();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ fn parse_args() -> ~str {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
println(parse_args());
|
||||
println!("{}", parse_args());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@
|
|||
|
||||
macro_rules! print_hd_tl (
|
||||
($field_hd:ident, $($field_tl:ident),+) => ({
|
||||
print(stringify!($field_hd));
|
||||
print("::[");
|
||||
print!("{}", stringify!($field_hd));
|
||||
print!("::[");
|
||||
$(
|
||||
print(stringify!($field_tl));
|
||||
print(", ");
|
||||
print!("{}", stringify!($field_tl));
|
||||
print!(", ");
|
||||
)+
|
||||
print("]\n");
|
||||
// FIXME: #9970
|
||||
print!("{}", "]\n");
|
||||
})
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ trait Fooable {
|
|||
|
||||
impl Fooable for uint {
|
||||
fn yes(self) {
|
||||
self.times(|| println("yes"));
|
||||
self.times(|| println!("yes"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ trait Inner {
|
|||
}
|
||||
|
||||
impl Inner for int {
|
||||
fn print(&self) { print(format!("Inner: {}\n", *self)); }
|
||||
fn print(&self) { print!("Inner: {}\n", *self); }
|
||||
}
|
||||
|
||||
struct Outer<'a> {
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ static test1: signature<'static> = signature {
|
|||
|
||||
pub fn main() {
|
||||
let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32];
|
||||
println(format!("{}",test==test1.pattern));
|
||||
println!("{}",test==test1.pattern);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ struct B<'a> { b: int, pa: &'a A }
|
|||
|
||||
impl IDummy for A {
|
||||
fn do_nothing(&self) {
|
||||
println("A::do_nothing() is called");
|
||||
println!("A::do_nothing() is called");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub fn main() {
|
|||
match &[(~5,~7)] {
|
||||
ps => {
|
||||
let (ref y, _) = ps[0];
|
||||
println(fmt!("1. y = %d", **y));
|
||||
println!("1. y = {}", **y);
|
||||
assert!(**y == 5);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,8 +24,8 @@ pub fn main() {
|
|||
match Some(&[(~5,)]) {
|
||||
Some(ps) => {
|
||||
let (ref y,) = ps[0];
|
||||
println(fmt!("2. y = %d", **y));
|
||||
if **y != 5 { println("sadness"); }
|
||||
println!("2. y = {}", **y);
|
||||
if **y != 5 { println!("sadness"); }
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ pub fn main() {
|
|||
match Some(&[(~5,~7)]) {
|
||||
Some(ps) => {
|
||||
let (ref y, ref z) = ps[0];
|
||||
println(fmt!("3. y = %d z = %d", **y, **z));
|
||||
println!("3. y = {} z = {}", **y, **z);
|
||||
assert!(**y == 5);
|
||||
}
|
||||
None => ()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
fn f() {
|
||||
let a = ~"hello";
|
||||
let b: &str = a;
|
||||
println(b);
|
||||
println!("{}", b);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@ fn parse_args() -> ~str {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
println(parse_args());
|
||||
println!("{}", parse_args());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ impl S {
|
|||
}
|
||||
|
||||
pub fn bar(self) {
|
||||
println(self.x);
|
||||
println!("{}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ use std::task;
|
|||
pub fn main() {
|
||||
let x = ~"Hello world!";
|
||||
do task::spawn {
|
||||
println(x);
|
||||
println!("{}", x);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
// Test that multibyte characters don't crash the compiler
|
||||
pub fn main() {
|
||||
println("마이너스 사인이 없으면");
|
||||
println!("마이너스 사인이 없으면");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ impl<T:ToStr> ToStr for PolymorphicThingy<T> {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
println(Thingy { x: 1, y: 2 }.to_str());
|
||||
println(PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_str());
|
||||
println!("{}", Thingy { x: 1, y: 2 }.to_str());
|
||||
println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
println("Hello world!");
|
||||
println!("Hello world!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ pub fn main() {
|
|||
let f = thing.find_str("{{");
|
||||
|
||||
if f.is_none() {
|
||||
println("None!");
|
||||
println!("None!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ struct Foo {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let f = |(x, _): (int, int)| println((x + 1).to_str());
|
||||
let g = |Foo { x: x, y: _y }: Foo| println((x + 1).to_str());
|
||||
let f = |(x, _): (int, int)| println!("{}", x + 1);
|
||||
let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1);
|
||||
f((2, 3));
|
||||
g(Foo { x: 1, y: 2 });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
// pp-exact
|
||||
|
||||
pub fn main() { println("Hello World"); }
|
||||
pub fn main() { println!("Hello World"); }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum color {
|
|||
|
||||
pub fn main() {
|
||||
let act = format!("{:?}", red);
|
||||
println(act);
|
||||
println!("{}", act);
|
||||
assert_eq!(~"red", act);
|
||||
assert_eq!(~"green", format!("{:?}", green));
|
||||
assert_eq!(~"white", format!("{:?}", white));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
use std::io::println;
|
||||
|
||||
trait Trait<T> {
|
||||
fn f(&self, x: T);
|
||||
}
|
||||
|
|
@ -21,7 +23,7 @@ struct Struct {
|
|||
|
||||
impl Trait<&'static str> for Struct {
|
||||
fn f(&self, x: &'static str) {
|
||||
println(~"Hi, " + x + ~"!");
|
||||
println!("Hi, {}!", x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ struct Struct {
|
|||
|
||||
impl Trait for Struct {
|
||||
fn f(&self) {
|
||||
println("Hi!");
|
||||
println!("Hi!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct S {
|
|||
|
||||
impl Foo<S> for S {
|
||||
fn f(&self, x: &S) {
|
||||
println(x.x.to_str());
|
||||
println!("{}", x.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct A {
|
|||
|
||||
impl Foo for A {
|
||||
fn f(&self) -> int {
|
||||
println(~"Today's number is " + self.x.to_str());
|
||||
println!("Today's number is {}", self.x);
|
||||
return self.x;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ mod base {
|
|||
|
||||
impl ::base::HasNew<Foo> for Foo {
|
||||
fn new() -> Foo {
|
||||
println("Foo");
|
||||
println!("Foo");
|
||||
Foo { dummy: () }
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ mod base {
|
|||
|
||||
impl ::base::HasNew<Bar> for Bar {
|
||||
fn new() -> Bar {
|
||||
println("Bar");
|
||||
println!("Bar");
|
||||
Bar { dummy: () }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ struct Foo;
|
|||
pub fn main() {
|
||||
let x: Foo = Foo;
|
||||
match x {
|
||||
Foo => { println("hi"); }
|
||||
Foo => { println!("hi"); }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue