Skip to content

unused_parens does not lint parentheses around method receiver #151985

@theemathas

Description

@theemathas

Code

struct Thing;
impl Thing {
    fn method(self) {}
}

fn main() {
    let x = Thing;
    (x).method();
}

Current output

No warnings

Desired output

Warn about the unused parentheses around x

Rationale and extra context

No response

Other cases

Rust Version

Reproducible on the playground with version 1.95.0-nightly (2026-01-30 a293cc4af8b26701c427)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.I-lang-nominatedNominated for discussion during a lang team meeting.L-false-negativeLint: False negative (should have fired but didn't).L-unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions