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

feat: hide type inlay hints for initializations of closures #12263

Merged
merged 1 commit into from May 20, 2022
Merged

feat: hide type inlay hints for initializations of closures #12263

merged 1 commit into from May 20, 2022

Conversation

andylizi
Copy link
Contributor

@andylizi andylizi commented May 15, 2022

hide_closure_initialization

This PR adds an option to hide the inlay hints for let IDENT_PAT = CLOSURE_EXPR;, which is a somewhat common coding pattern. Currently the inlay hints for the assigned variable and the closure expression itself are both displayed, making it rather repetitive.

In order to be consistent with closure return type hints, only closures with block bodies will be hid by this option.

Personally I'd feel comfortable making it always enabled (or at least when closure return type hints are enabled), but considering the precedent set in #10761, I introduced an off-by-default option for this.

changelog feature: option to hide type inlay hints for let statements that initialize to a closure

Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Sounds good to me, I am still thinking about whether to remove the block expression limitation altogether. I only added it as I wasn't sure how helpful they'd be for non block expressions.

crates/rust-analyzer/src/config.rs Show resolved Hide resolved
@HKalbasi
Copy link
Member

I would like to see impl Fn, impl FnMut, ... as inlay hint for closures, which I think is a useful data and non trivial in first look. In current state IMO it make sense to enable this by default.

@bors
Copy link
Collaborator

bors commented May 16, 2022

☔ The latest upstream changes (presumably #12253) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented May 20, 2022

☔ The latest upstream changes (presumably #12320) made this pull request unmergeable. Please resolve the merge conflicts.

@Veykril
Copy link
Member

Veykril commented May 20, 2022

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented May 20, 2022

📌 Commit 2b1c1a9 has been approved by Veykril

@bors
Copy link
Collaborator

bors commented May 20, 2022

⌛ Testing commit 2b1c1a9 with merge 41388bf...

@bors
Copy link
Collaborator

bors commented May 20, 2022

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

@bors bors merged commit 41388bf into rust-lang:master May 20, 2022
@andylizi andylizi deleted the hide-type-hint-closure branch May 20, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants