Skip to content

No unnecessary parentheses warning in types #64169

Closed
@oli-cosmian

Description

@oli-cosmian

Types can be parenthesized, which is useful for e.g. dyn (Foo + 'static) or similar, but often these parentheses are unnecessary. Whenever a trivial type is parenthesized the compiler should suggest to remove the parentheses

pub fn foo() -> (i32) { 42 }

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 0.64s

This issue has been assigned to @sjmann via this comment.

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions