Skip to content

Commit 3b02589

Browse files
committed
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!()).
1 parent 8d0feb5 commit 3b02589

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/libsyntax/ext/expand.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -644,16 +644,22 @@ pub fn core_macros() -> @str {
644644
);
645645
)
646646

647-
macro_rules! print(
648-
($( $arg:expr),+) => ( {
649-
print(fmt!($($arg),+));
650-
} )
647+
macro_rules! printf (
648+
($arg:expr) => (
649+
print(fmt!(\"%?\", $arg))
650+
);
651+
($( $arg:expr ),+) => (
652+
print(fmt!($($arg),+))
653+
)
651654
)
652655

653-
macro_rules! println(
654-
($( $arg:expr),+) => ( {
655-
println(fmt!($($arg),+));
656-
} )
656+
macro_rules! printfln (
657+
($arg:expr) => (
658+
println(fmt!(\"%?\", $arg))
659+
);
660+
($( $arg:expr ),+) => (
661+
println(fmt!($($arg),+))
662+
)
657663
)
658664
}";
659665
}

0 commit comments

Comments
 (0)