Skip to content

Commit deff699

Browse files
committed
Auto merge of rust-lang#139131 - m-ou-se:format-args-struct-expr, r=Mark-Simulacrum
Simplify expansion for format_args!(). Instead of calling `Placeholder::new()`, we can just use a struct expression directly. Before: ```rust Placeholder::new(…, …, …, …) ``` After: ```rust Placeholder { position: …, flags: …, width: …, precision: …, } ``` (I originally avoided the struct expression, because `Placeholder` had a lot of fields. But now that rust-lang#136974 is merged, it only has four fields left.) This will make the `fmt` argument to `fmt::Arguments::new_v1_formatted()` a candidate for const promotion, which is important if we ever hope to tackle rust-lang#92698 (It doesn't change anything yet though, because the `args` argument to `fmt::Arguments::new_v1_formatted()` is not const-promotable.)
2 parents 2389f01 + 098c62c commit deff699

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

core/src/fmt/rt.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub struct Placeholder {
2020
pub width: Count,
2121
}
2222

23+
#[cfg(bootstrap)]
2324
impl Placeholder {
24-
#[cfg(bootstrap)]
2525
#[inline]
2626
pub const fn new(
2727
position: usize,
@@ -33,12 +33,6 @@ impl Placeholder {
3333
) -> Self {
3434
Self { position, fill, align, flags, precision, width }
3535
}
36-
37-
#[cfg(not(bootstrap))]
38-
#[inline]
39-
pub const fn new(position: usize, flags: u32, precision: Count, width: Count) -> Self {
40-
Self { position, flags, precision, width }
41-
}
4236
}
4337

4438
#[cfg(bootstrap)]

0 commit comments

Comments
 (0)