Skip to content

Commit 427288b

Browse files
committed
Auto merge of #140188 - nnethercote:streamline-format-macro, r=cuviper
Streamline the `format` macro. Removing the unnecessary local variable speeds up compilation a little. r? `@cuviper`
2 parents f242d6c + bc8df50 commit 427288b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

library/alloc/src/macros.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ macro_rules! vec {
105105
macro_rules! format {
106106
($($arg:tt)*) => {
107107
$crate::__export::must_use({
108-
let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
109-
res
108+
$crate::fmt::format($crate::__export::format_args!($($arg)*))
110109
})
111110
}
112111
}

tests/pretty/issue-4264.pp

+6-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@
3131

3232
((::alloc::__export::must_use as
3333
fn(String) -> String {must_use::<String>})(({
34-
let res =
35-
((::alloc::fmt::format as
36-
for<'a> fn(Arguments<'a>) -> String {format})(((format_arguments::new_const
37-
as
38-
fn(&[&'static str; 1]) -> Arguments<'_> {Arguments::<'_>::new_const::<1>})((&([("test"
39-
as &str)] as [&str; 1]) as &[&str; 1])) as Arguments<'_>))
40-
as String);
41-
(res as String)
34+
((::alloc::fmt::format as
35+
for<'a> fn(Arguments<'a>) -> String {format})(((format_arguments::new_const
36+
as
37+
fn(&[&'static str; 1]) -> Arguments<'_> {Arguments::<'_>::new_const::<1>})((&([("test"
38+
as &str)] as [&str; 1]) as &[&str; 1])) as Arguments<'_>))
39+
as String)
4240
} as String)) as String);
4341
} as ())
4442
type Foo = [i32; (3 as usize)];

0 commit comments

Comments
 (0)