Skip to content

Conversation

@ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Aug 23, 2025

Reborrows are consecutive deref then ref. Make it the default because reborrows are mostly useless to the programmer.

Also rename rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "reborrow" to rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "borrows", as it's not about reborrows but about any ref/deref and it's confusing with the new setting.

Closes #20516.

Reborrows are consecutive deref then ref. Make it the default because reborrows are mostly useless to the programmer.

Also rename `rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "reborrow"` to `rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "borrows"`, as it's not about reborrows but about any ref/deref and it's confusing with the new setting.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2025
Copy link
Member

@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

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

It's a bit surprising that current "Reborrows" option has been enabling everything except pointer cast and never to any adjustments 😅

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Aug 26, 2025
Merged via the queue into rust-lang:master with commit 25adf34 Aug 26, 2025
16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2025
@ChayimFriedman2 ChayimFriedman2 deleted the reborrow branch August 26, 2025 06:20
@lnicola lnicola changed the title feat: Add an option to remove reborrows from adjustment inlay hints feat: Add an option to hide reborrows in adjustment inlay hints Aug 26, 2025
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum AdjustmentHints {
Always,
ReborrowOnly,
Copy link
Member

Choose a reason for hiding this comment

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

note this breaks user configs using the old key

Copy link
Contributor Author

@ChayimFriedman2 ChayimFriedman2 Sep 4, 2025

Choose a reason for hiding this comment

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

That's the inlay hints parameter, the real config has #[serde(alias)] for this reason.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I just used the pre-release and got an error about unrecognized config though

#[serde(rename_all = "snake_case")]
enum AdjustmentHintsDef {
Reborrow,
#[serde(alias = "Reborrow")]
Copy link
Member

Choose a reason for hiding this comment

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

Oh maybe this must be reborrow? Not sure if rename_all applies to aliases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not. I even thought about that, but somehow still wrote Reborrow. Created #20606 for that.

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.

Reborrow expressionAdjustmentHints are rarely useful

4 participants