Skip to content

Reenable linting on UFCS deref calls #14808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented May 15, 2025

Was disabled in #10855 due to a broken suggestion. This will only lint if a type is not proveded (e.g. T::deref).

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2025

r? @llogiq

rustbot has assigned @llogiq.
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 rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 15, 2025
Comment on lines 694 to 699
let mutbl = if tcx.is_diagnostic_item(sym::deref_method, def_id) {
Mutability::Not
} else if tcx.trait_of_item(def_id)? == tcx.lang_items().deref_mut_trait()? {
Some((
RefOp::Method {
mutbl: Mutability::Mut,
is_ufcs,
},
arg,
))
Mutability::Mut
} else {
None
}
return None;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This does only one lookup:

    let mutbl = match tcx.get_diagnostic_name(def_id)? {
        sym::deref_method => Mutability::Not,
        sym::deref_mut_method => Mutability::Mut,
        _ => return None,
    };

@Jarcho Jarcho force-pushed the deref_methods_ufcs branch from 10e43fd to d69df22 Compare May 16, 2025 10:16
@Jarcho Jarcho force-pushed the deref_methods_ufcs branch from d69df22 to 27acbf2 Compare May 16, 2025 10:45
@llogiq llogiq added this pull request to the merge queue May 16, 2025
@llogiq
Copy link
Contributor

llogiq commented May 16, 2025

Thank you!

Merged via the queue into rust-lang:master with commit 5cb7e40 May 16, 2025
11 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants