Suggest the extra comma for 1-ary tuple when warning about unnecessary parentheses around type #86019
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
L-unused_parens
Lint: unused_parens
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b6faae0b3f3e40ccb0c2158eb481b989
The current output is (
1.52.1
,1.53.0-beta.3
and1.54.0-nightly
):Ideally the output should look like:
While I appreciate that using 1-ary tuple
(T,)
may seem odd in most cases it is still part of the language: rust reference. It is also something that the standard library leverages too (generalising trait implementations for 1-ary tuple). Providing this extra note could go a long way to help developers writing generalised implementation of their Trait for n-ary tuples.The text was updated successfully, but these errors were encountered: