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: Fix inlining closures from local variables and functions #15651

Merged
merged 2 commits into from Sep 22, 2023

Conversation

rmehri01
Copy link
Contributor

Previously, closures were not properly wrapped in parentheses for the inline_local_variable and inline_call assists, leading to the usages being incorrectly called:

fn main() {
    let $0f = || 2;
    let _ = f();
}

Now produces:

fn main() {
    let _ = (|| 2)();
}

Instead of:

fn main() {
    let _ = || 2();
}

Closes #15639

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2023
@lnicola
Copy link
Member

lnicola commented Sep 22, 2023

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 22, 2023

📌 Commit ea11846 has been approved by lnicola

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Sep 22, 2023

⌛ Testing commit ea11846 with merge c22bb03...

@lnicola lnicola changed the title Fix inlining closures from local variables and functions fix: Fix inlining closures from local variables and functions Sep 22, 2023
@bors
Copy link
Collaborator

bors commented Sep 22, 2023

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing c22bb03 to master...

@bors bors merged commit c22bb03 into rust-lang:master Sep 22, 2023
10 checks passed
@rmehri01 rmehri01 deleted the 15639_fix_inline_local_closure branch October 2, 2023 15:17
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.

Inlining closure caused priority error at the call point
4 participants