Skip to content

Commit f1ca69d

Browse files
committed
Revert write! and writeln! to late drop temporaries
1 parent cb0ed1b commit f1ca69d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

library/core/src/macros/mod.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,9 @@ macro_rules! r#try {
496496
#[stable(feature = "rust1", since = "1.0.0")]
497497
#[cfg_attr(not(test), rustc_diagnostic_item = "write_macro")]
498498
macro_rules! write {
499-
($dst:expr, $($arg:tt)*) => {{
500-
let result = $dst.write_fmt($crate::format_args!($($arg)*));
501-
result
502-
}};
499+
($dst:expr, $($arg:tt)*) => {
500+
$dst.write_fmt($crate::format_args!($($arg)*))
501+
};
503502
}
504503

505504
/// Write formatted data into a buffer, with a newline appended.
@@ -554,10 +553,9 @@ macro_rules! writeln {
554553
($dst:expr $(,)?) => {
555554
$crate::write!($dst, "\n")
556555
};
557-
($dst:expr, $($arg:tt)*) => {{
558-
let result = $dst.write_fmt($crate::format_args_nl!($($arg)*));
559-
result
560-
}};
556+
($dst:expr, $($arg:tt)*) => {
557+
$dst.write_fmt($crate::format_args_nl!($($arg)*))
558+
};
561559
}
562560

563561
/// Indicates unreachable code.

0 commit comments

Comments
 (0)