]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #91359 - dtolnay:args, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Fri, 21 Jan 2022 06:20:18 +0000 (06:20 +0000)
committerbors <bors@rust-lang.org>
Fri, 21 Jan 2022 06:20:18 +0000 (06:20 +0000)
Emit simpler code from format_args

I made this PR so that `cargo expand` dumps a less overwhelming amount of formatting-related code.

<br>

`println!("rust")` **Before:**

```rust
{
    ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"],
                                                     &match () {
                                                          _args => [],
                                                      }));
};
```

**After:**

```rust
{ ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[])); };
```

`println!("{}", x)` **Before:**

```rust
{
    ::std::io::_print(::core::fmt::Arguments::new_v1(
        &["", "\n"],
        &match (&x,) {
            _args => [::core::fmt::ArgumentV1::new(
                _args.0,
                ::core::fmt::Display::fmt,
            )],
        },
    ));
};
```

**After:**

```rust
{
    ::std::io::_print(::core::fmt::Arguments::new_v1(
        &["", "\n"],
        &[::core::fmt::ArgumentV1::new(&x, ::core::fmt::Display::fmt)],
    ));
};
```


Trivial merge