-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b6faae0b3f3e40ccb0c2158eb481b989
pub type U8 = (u8);
The current output is (1.52.1
, 1.53.0-beta.3
and 1.54.0-nightly
):
warning: unnecessary parentheses around type
--> src/lib.rs:1:15
|
1 | pub type U8 = (u8);
| ^^^^ help: remove these parentheses
|
= note: `#[warn(unused_parens)]` on by default
warning: 1 warning emitted
Ideally the output should look like:
warning: unnecessary parentheses around type
--> src/lib.rs:1:15
|
1 | pub type U8 = (u8);
| ^^^^ help: remove these parentheses
|
= note: `#[warn(unused_parens)]` on by default
= note: if you meant to use 1-ary tuple, add an extra comma: `(T,)`
warning: 1 warning emitted
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.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.