Skip to content

feat: Add an option to hide adjustment hints outside of unsafe blocks and functions#13817

Merged
bors merged 4 commits into
rust-lang:masterfrom
WaffleLapkin:hide_adjustment_hints_outside_of_unsafe
Dec 22, 2022
Merged

feat: Add an option to hide adjustment hints outside of unsafe blocks and functions#13817
bors merged 4 commits into
rust-lang:masterfrom
WaffleLapkin:hide_adjustment_hints_outside_of_unsafe

Conversation

@WaffleLapkin

Copy link
Copy Markdown
Member

As the title suggests: this PR adds an option (namely rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe) that allows to hide adjustment hints outside of unsafe blocks and functions:

2022-12-21_23-11

Requested by @BoxyUwU <3

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 21, 2022
Comment thread crates/hir/src/lib.rs
Some(())
}

fn is_inside_unsafe(sema: &Semantics<'_, RootDatabase>, node: &SyntaxNode) -> bool {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This seems to be working fine, but I'm left wondering if there is a better way...

Comment thread crates/hir/src/semantics.rs Outdated
Comment thread crates/hir/src/semantics.rs Outdated
.unwrap_or(false)
}

fn is_inside_unsafe(&self, node: &SyntaxNode) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fn is_inside_unsafe(&self, node: &SyntaxNode) -> bool {
fn is_inside_unsafe(&self, node: &ast::Expr)-> bool {

This handles expressions so it should only take such

@rust-cloud-vms rust-cloud-vms Bot force-pushed the hide_adjustment_hints_outside_of_unsafe branch from bb3a66b to 94d0772 Compare December 21, 2022 23:00
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
@rust-cloud-vms rust-cloud-vms Bot force-pushed the hide_adjustment_hints_outside_of_unsafe branch from 94d0772 to 1038db5 Compare December 21, 2022 23:00
@WaffleLapkin WaffleLapkin requested a review from Veykril December 21, 2022 23:03
@Veykril

Veykril commented Dec 22, 2022

Copy link
Copy Markdown
Member

This might not play completely nice with macro expansions, but we'll see
@bors r+

@bors

bors commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

📌 Commit 1038db5 has been approved by Veykril

It is now in the queue for this repository.

@bors

bors commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 1038db5 with merge eb3963b...

@bors

bors commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

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

@bors bors merged commit eb3963b into rust-lang:master Dec 22, 2022
@bors bors mentioned this pull request Dec 22, 2022
@WaffleLapkin WaffleLapkin deleted the hide_adjustment_hints_outside_of_unsafe branch January 9, 2023 13:42
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.

5 participants