]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #87267 - dtolnay:negspace, r=Aaron1011
authorYuki Okushi <jtitor@2k36.org>
Tue, 3 Aug 2021 23:05:50 +0000 (08:05 +0900)
committerGitHub <noreply@github.com>
Tue, 3 Aug 2021 23:05:50 +0000 (08:05 +0900)
Remove space after negative sign in Literal to_string

Negative proc macro literal tokens used to be printed with a space between the minus sign and the magnitude. That's because `impl ToString for Literal` used to convert the Literal into a TokenStream, which splits the minus sign into a separate Punct token.

```rust
Literal::isize_unsuffixed(-10).to_string()  // "- 10"
```

This PR updates the ToString impl to directly use `rustc_ast::token::Lit`'s ToString, which matches the way Rust negative numbers are idiomatically written without a space.

```rust
Literal::isize_unsuffixed(-10).to_string()  // "-10"
```


Trivial merge