Skip to content

Conversation

relaxcn
Copy link
Contributor

@relaxcn relaxcn commented Oct 13, 2025

I'm working on an enhancement to clippy::explicit_deref_methods, which would allow explicit deref or deref_mut method calls in implementation of the the Deref or DerefMut trait, so I need a DerefMut diagnostic item to check if we are already in the impl of DerefMut trait.

@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 Oct 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 13, 2025

r? @lcnr

rustbot has assigned @lcnr.
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

@hkBst
Copy link
Member

hkBst commented Oct 13, 2025

@relaxcn Why would it be a good idea to allow such calls in Deref(Mut) impls?

@relaxcn
Copy link
Contributor Author

relaxcn commented Oct 13, 2025

@relaxcn Why would it be a good idea to allow such calls in Deref(Mut) impls?

Reference to rust-lang/rust-clippy#15392, I think it is make sense to me.

/// *x = 'b';
/// assert_eq!('b', x.value);
/// ```
#[lang = "deref_mut"]
Copy link
Member

Choose a reason for hiding this comment

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

DerefMut already has a lang item, can you use LangItem::DeferMut instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants