diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-07-24 10:44:00 -0700 | 
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-07-24 11:12:00 -0700 | 
| commit | f1ca69d2453710587804b830182f3de76d9a9e70 (patch) | |
| tree | f196b448ca18300902ee7ca264e035f17e079aa8 | |
| parent | cb0ed1bdaed082205c7da4375b78a112a0872ddf (diff) | |
| download | rust-f1ca69d2453710587804b830182f3de76d9a9e70.tar.gz rust-f1ca69d2453710587804b830182f3de76d9a9e70.zip  | |
Revert write! and writeln! to late drop temporaries
| -rw-r--r-- | library/core/src/macros/mod.rs | 14 | 
1 files changed, 6 insertions, 8 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index bd62bc5c305..3a115a8b8b6 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -496,10 +496,9 @@ macro_rules! r#try { #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "write_macro")] macro_rules! write { - ($dst:expr, $($arg:tt)*) => {{ - let result = $dst.write_fmt($crate::format_args!($($arg)*)); - result - }}; + ($dst:expr, $($arg:tt)*) => { + $dst.write_fmt($crate::format_args!($($arg)*)) + }; } /// Write formatted data into a buffer, with a newline appended. @@ -554,10 +553,9 @@ macro_rules! writeln { ($dst:expr $(,)?) => { $crate::write!($dst, "\n") }; - ($dst:expr, $($arg:tt)*) => {{ - let result = $dst.write_fmt($crate::format_args_nl!($($arg)*)); - result - }}; + ($dst:expr, $($arg:tt)*) => { + $dst.write_fmt($crate::format_args_nl!($($arg)*)) + }; } /// Indicates unreachable code.  | 
