Commit 2ea33b5
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.)3 files changed
+18
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
334 | 332 | | |
335 | 333 | | |
336 | 334 | | |
| |||
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
394 | 392 | | |
395 | 393 | | |
396 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
| 989 | + | |
989 | 990 | | |
990 | 991 | | |
991 | 992 | | |
| |||
1570 | 1571 | | |
1571 | 1572 | | |
1572 | 1573 | | |
| 1574 | + | |
1573 | 1575 | | |
1574 | 1576 | | |
1575 | 1577 | | |
| |||
1585 | 1587 | | |
1586 | 1588 | | |
1587 | 1589 | | |
| 1590 | + | |
1588 | 1591 | | |
1589 | 1592 | | |
1590 | 1593 | | |
| |||
2274 | 2277 | | |
2275 | 2278 | | |
2276 | 2279 | | |
| 2280 | + | |
2277 | 2281 | | |
2278 | 2282 | | |
2279 | 2283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | | - | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 36 | | |
43 | 37 | | |
44 | 38 | | |
| |||
0 commit comments