1
Fork 0

Format core and std macro rules, removing needless surrounding blocks

This commit is contained in:
David Tolnay 2022-03-09 21:30:52 -08:00
parent 335ffbfa54
commit af53809c87
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
6 changed files with 72 additions and 40 deletions

View file

@ -60,7 +60,9 @@ macro_rules! panic {
#[cfg_attr(not(test), rustc_diagnostic_item = "print_macro")]
#[allow_internal_unstable(print_internals)]
macro_rules! print {
($($arg:tt)*) => ($crate::io::_print($crate::format_args!($($arg)*)));
($($arg:tt)*) => {
$crate::io::_print($crate::format_args!($($arg)*))
};
}
/// Prints to the standard output, with a newline.
@ -94,10 +96,12 @@ macro_rules! print {
#[cfg_attr(not(test), rustc_diagnostic_item = "println_macro")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! println {
() => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::io::_print($crate::format_args_nl!($($arg)*));
})
() => {
$crate::print!("\n")
};
($($arg:tt)*) => {
$crate::io::_print($crate::format_args_nl!($($arg)*))
};
}
/// Prints to the standard error.
@ -126,7 +130,9 @@ macro_rules! println {
#[cfg_attr(not(test), rustc_diagnostic_item = "eprint_macro")]
#[allow_internal_unstable(print_internals)]
macro_rules! eprint {
($($arg:tt)*) => ($crate::io::_eprint($crate::format_args!($($arg)*)));
($($arg:tt)*) => {
$crate::io::_eprint($crate::format_args!($($arg)*))
};
}
/// Prints to the standard error, with a newline.
@ -155,10 +161,12 @@ macro_rules! eprint {
#[cfg_attr(not(test), rustc_diagnostic_item = "eprintln_macro")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! eprintln {
() => ($crate::eprint!("\n"));
($($arg:tt)*) => ({
$crate::io::_eprint($crate::format_args_nl!($($arg)*));
})
() => {
$crate::eprint!("\n")
};
($($arg:tt)*) => {
$crate::io::_eprint($crate::format_args_nl!($($arg)*))
};
}
/// Prints and returns the value of a given expression for quick and dirty