Skip to content

Lint unused parentheses around method receiver#151986

Draft
chenyukang wants to merge 2 commits intorust-lang:mainfrom
chenyukang:yukang-fix-151985-unused-parens-method-receiver
Draft

Lint unused parentheses around method receiver#151986
chenyukang wants to merge 2 commits intorust-lang:mainfrom
chenyukang:yukang-fix-151985-unused-parens-method-receiver

Conversation

@chenyukang
Copy link
Copy Markdown
Member

@chenyukang chenyukang commented Feb 2, 2026

Extends the unused_parens lint to detect unnecessary parentheses around method receivers like (x).method().

Fixes #151985

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 2, 2026

compiler-builtins is developed in its own repository. If possible, consider making this change to rust-lang/compiler-builtins instead.

cc @tgross35

@rustbot rustbot added the A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) label Feb 2, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 2, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 2, 2026

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 2, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@chenyukang chenyukang closed this Feb 2, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 2, 2026
@chenyukang chenyukang reopened this Feb 2, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 2, 2026
@chenyukang chenyukang marked this pull request as draft February 2, 2026 08:36
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 2, 2026
@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from c1b3bf0 to c6acedc Compare February 2, 2026 08:39
},
alloc,
));
let uninit_ptr: NonNull<_> = (unsafe { &mut *uninit_raw_ptr }).into();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems better add parens for unsafe block?

@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from c6acedc to 89085e5 Compare February 2, 2026 08:57
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 926cf7d to dc54301 Compare February 2, 2026 09:58
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from dc54301 to 5733cfa Compare February 2, 2026 11:06
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 5733cfa to 39cd80f Compare February 2, 2026 11:36
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 39cd80f to 823f304 Compare February 2, 2026 12:10
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 823f304 to 4a5a8e7 Compare February 2, 2026 12:51
@rustbot rustbot added the T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. label Feb 2, 2026
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 4a5a8e7 to d657d00 Compare February 2, 2026 13:32
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from d657d00 to d18d47c Compare February 2, 2026 14:24
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from d18d47c to 885e44e Compare February 5, 2026 12:52
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 885e44e to e6c8654 Compare March 26, 2026 08:12
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from 8dff78c to afbd07a Compare March 26, 2026 12:38
@chenyukang chenyukang force-pushed the yukang-fix-151985-unused-parens-method-receiver branch from afbd07a to d9ef5b9 Compare March 26, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unused_parens does not lint parentheses around method receiver

4 participants