Skip to content

Fix suggestion on fully qualified syntax #10855

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 2 commits into from
Jun 4, 2023

Conversation

Centri3
Copy link
Member

@Centri3 Centri3 commented Jun 1, 2023

fixes #10850

changelog: [explicit_deref_methods]: Fix malformed suggestion on Foo::deref(&foo)

@rustbot
Copy link
Collaborator

rustbot commented Jun 1, 2023

r? @llogiq

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 1, 2023
@Alexendoo
Copy link
Member

The Foo part can participate in type inference

use std::ops::Deref;

fn main() {
    let a = Default::default();
    let b = String::deref(&a);
}

Maybe we ought to preserve Foo::deref anyway though as unlike .deref() it does provide more information to the reader than the equivalent &*, what type is being deref'd can be confusing

@Centri3
Copy link
Member Author

Centri3 commented Jun 1, 2023

Ah yeah, so this will still cause an error on that as well. The best path forward then would probably be to preserve it as you said, and specify that it excludes Foo::deref like done with d.unwrap().deref()

@llogiq
Copy link
Contributor

llogiq commented Jun 4, 2023

Thanks @Alexendoo for taking on the review, and thanks @Centri3 for pushing this forward!

@bors r+

@bors
Copy link
Contributor

bors commented Jun 4, 2023

📌 Commit eed4662 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 4, 2023

⌛ Testing commit eed4662 with merge 58befc7...

@bors
Copy link
Contributor

bors commented Jun 4, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 58befc7 to master...

@bors bors merged commit 58befc7 into rust-lang:master Jun 4, 2023
@Centri3 Centri3 deleted the explicit_deref_methods branch June 5, 2023 00:02
github-merge-queue bot pushed a commit that referenced this pull request May 16, 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
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.

explicit_deref_methods malformed suggestion on fully qualified syntax
5 participants