Improve suggestion for missing fmt str in println
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
This commit is contained in:
committed by
Esteban Küber
parent
bc14d71622
commit
f53c145ef1
@@ -155,8 +155,14 @@ macro_rules! print {
|
||||
#[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)*));
|
||||
($fmt:expr) => ({
|
||||
print!($fmt);
|
||||
print!("\n");
|
||||
});
|
||||
($fmt:expr, $($arg:tt)*) => ({
|
||||
print!($fmt, $($arg)*);
|
||||
print!("\n");
|
||||
});
|
||||
}
|
||||
|
||||
/// Macro for printing to the standard error.
|
||||
|
||||
Reference in New Issue
Block a user