Skip to content
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

fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait #16647

Merged

Conversation

Young-Flash
Copy link
Member

close #16596

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2024
@Young-Flash Young-Flash force-pushed the fix_replace_filter_map_next_with_find_map branch from d9dedbd to 0978d16 Compare February 23, 2024 13:06
self.diagnostics.push(BodyValidationDiagnostic::ReplaceFilterMapNextWithFindMap {
method_call_expr: call_id,
});
}

let receiver_ty = self.infer[*receiver].strip_references().clone();
Copy link
Member

Choose a reason for hiding this comment

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

Why are we stripping it here? If this is due to coercions and autoref then we should check the adjustments:

    let coerced = self.infer
            .expr_adjustments
            .get(receiver)
            .and_then(|adjusts| adjusts.last().map(|adjust| adjust.target.clone()));

Copy link
Member

Choose a reason for hiding this comment

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

Ah nvm you want to get the dyn trait, then we should do the stripping where we check for the dyn trait, that seems more proper.

@Veykril Veykril 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 26, 2024
@Veykril
Copy link
Member

Veykril commented Feb 26, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 26, 2024

📌 Commit fd0cddf has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Feb 26, 2024

⌛ Testing commit fd0cddf with merge ef08dab...

bors added a commit that referenced this pull request Feb 26, 2024
…ind_map, r=Veykril

fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait

close #16596
@Veykril
Copy link
Member

Veykril commented Feb 26, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 26, 2024

📌 Commit 7a58a23 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Feb 26, 2024

⌛ Testing commit 7a58a23 with merge 8929853...

@bors
Copy link
Collaborator

bors commented Feb 26, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 8929853 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RA suggests incorrect quick fix / replacement that Clippy doesn't
4 participants