rust-lang / rust-lang/rust

`unused_parens` does not lint parentheses around method receiver

Open
#151,985 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-lints I-lang-radar L-false-negative L-unused_parens T-compiler T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Rust playground example and tracing the unused_parens lint entry point in the compiler. The work is done when parentheses around a method receiver such as (x).method() produce a warning, with coverage for the shown case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.