]> git.lizzy.rs Git - rust.git/commitdiff
Rename print!()/println!() to printf!()/printfln!()
authorKevin Ballard <kevin@sb.org>
Sat, 13 Jul 2013 21:08:05 +0000 (14:08 -0700)
committerKevin Ballard <kevin@sb.org>
Sat, 13 Jul 2013 21:33:41 +0000 (14:33 -0700)
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!()).

src/libsyntax/ext/expand.rs

index 73fa659a7aab11a3f5cf8b736134152686a1a0c9..2c3f42cca9aac4a653c6e52b471480178b30b8ab 100644 (file)
@@ -644,16 +644,22 @@ macro_rules! cond (
         );
     )
 
-    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),+))
+        )
     )
 }";
 }