rust/compiler/rustc_infer
Mara Bos 557d300e1b
Rollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelid
Suggest 1-tuple parentheses on exprs without existing parens

A follow-on from #86116, split out from #90677.

This alters the suggestion to add a trailing comma to create a 1-tuple - previously we would only apply this if the relevant expression was parenthesised. We now make the suggestion regardless of parentheses, which reduces the fragility of the check (w.r.t formatting).

e.g.
```rust
let a: Option<(i32,)> = Some(3);
```

gets the below suggestion:

```rust
let a: Option<(i32,)> = Some((3,));
//                           ^ ^^
```

This change also improves the suggestion in other ways, such as by only making the suggestion if the types would match after the suggestion is applied and making the suggestion a multipart suggestion.
2022-02-07 14:08:31 +00:00
..
src Rollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelid 2022-02-07 14:08:31 +00:00
Cargo.toml Migrate to 2021 2021-09-20 22:21:42 -04:00