about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-05 15:04:20 +0100
committerGitHub <noreply@github.com>2021-12-05 15:04:20 +0100
commita8f8f746fc046a025d1b8c464ce28f6b828f32e9 (patch)
tree162c91c875293c2c5b332f5fca640ea38c515956 /compiler/rustc_codegen_gcc
parent214b2a126bc6654bf60108aea2e8dce94b096b4b (diff)
parentb516a8c5cbcde670e509182592547072a723875a (diff)
downloadrust-a8f8f746fc046a025d1b8c464ce28f6b828f32e9.tar.gz
rust-a8f8f746fc046a025d1b8c464ce28f6b828f32e9.zip
Rollup merge of #91437 - dtolnay:emptybrace, r=nagisa
Pretty print empty blocks as {}

**Example:**

```rust
macro_rules! p {
    ($e:expr) => {
        println!("{}", stringify!($e));
    };
    ($i:item) => {
        println!("{}", stringify!($i));
    };
}

fn main() {
    p!(if true {});
    p!(struct S {});
}
```

**Before:**

```console
if true { }
struct S {
}
```

**After:**

```console
if true {}
struct S {}
```

This affects [`dbg!`](https://doc.rust-lang.org/std/macro.dbg.html), as well as ecosystem uses of stringify such as in [`anyhow::ensure!`](https://docs.rs/anyhow/1/anyhow/macro.ensure.html). Printing a `{ }` in today's heavily rustfmt'd world comes out looking jarring/sloppy.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions