Skip to content

Find function path references early in the same lint pass #12147

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
Jan 20, 2024

Conversation

y21
Copy link
Member

@y21 y21 commented Jan 14, 2024

This removes a visitor that existed to collect paths to functions in a context where the exact signature is required in order to cancel the lint.
E.g. when there's a let _: fn(&mut i32) = path_to_fn_ref_mut_i32; statement somewhere in the crate, we shouldn't suggest removing the mutable reference in the function signature.

It was doing a whole pass through the crate at the end, which seems unnecessary.
It seems like we should be able to add entries to the map in the same lint pass.
The map is untouched all the way until check_crate_post (at which point it will be populated by the visitor and finally checked), so it doesn't seem like this changes behavior: it will only be fully populated by the time we reach check_crate_post no matter what.

I don't think this will have a significant perf impact but it did show up in a profile with 0.5% for a crate I was looking into and looked like a low hanging fruit.

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2024

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 Jan 14, 2024
@llogiq
Copy link
Contributor

llogiq commented Jan 20, 2024

Thank you!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 20, 2024

📌 Commit 0774489 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 20, 2024

⌛ Testing commit 0774489 with merge 70573af...

@bors
Copy link
Contributor

bors commented Jan 20, 2024

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

@bors bors merged commit 70573af into rust-lang:master Jan 20, 2024
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