Rename print!()/println!() to printf!()/printfln!()

The new names make it obvious that these generate formatted output.

Add a one-argument case that uses %? to format, just like the other
format-using macros (e.g. info!()).
This commit is contained in:
Kevin Ballard 2013-07-13 14:08:05 -07:00
parent 8d0feb58e7
commit 3b0258916d

View file

@ -644,16 +644,22 @@ pub fn core_macros() -> @str {
);
)
macro_rules! print(
($( $arg:expr),+) => ( {
print(fmt!($($arg),+));
} )
macro_rules! printf (
($arg:expr) => (
print(fmt!(\"%?\", $arg))
);
($( $arg:expr ),+) => (
print(fmt!($($arg),+))
)
)
macro_rules! println(
($( $arg:expr),+) => ( {
println(fmt!($($arg),+));
} )
macro_rules! printfln (
($arg:expr) => (
println(fmt!(\"%?\", $arg))
);
($( $arg:expr ),+) => (
println(fmt!($($arg),+))
)
)
}";
}