Auto merge of #36825 - sbwtw:master, r=alexcrichton

add println!() macro with out any arguments

lets add println!() to write "\n".
like java https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println()
This commit is contained in:
bors
2016-10-11 01:17:03 -07:00
committed by GitHub
3 changed files with 13 additions and 3 deletions

View File

@@ -112,12 +112,14 @@ macro_rules! print {
/// # Examples
///
/// ```
/// println!();
/// println!("hello there!");
/// println!("format {} arguments", "some");
/// ```
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
macro_rules! println {
() => (print!("\n"));
($fmt:expr) => (print!(concat!($fmt, "\n")));
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
}