Skip to content

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Dec 4, 2025

In the inferred type hints, expand the line too long. add config to disable it.

Example

{"rust-analyzer.inlayHints.typeHints.hideInferredTypes": true}
use std::collections::HashMap;
fn foo(iter: Vec<Result<HashMap<String, String>, std::io::Error>>) {
    let output = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
}

Before this PR

let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_ = HashMap<String, String>>, _ = Error>>().unwrap();

After this PR

let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2025
@A4-Tacks A4-Tacks force-pushed the hide-placeholder-hints branch 2 times, most recently from 80543cb to 10d088d Compare December 4, 2025 06:16
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

I think I prefer the phrase to be positive, all other configs are this way. Also "placeholder" may not be clear to the user, so something like inferred_types = true by default.

@A4-Tacks A4-Tacks force-pushed the hide-placeholder-hints branch from 10d088d to fa14a7f Compare December 4, 2025 17:40
In the inferred type hints, expand the line too long. add config to disable it.

Example
---
```json
{"rust-analyzer.inlayHints.typeHints.hideInferredTypes": true}
```

```rust
use std::collections::HashMap;
fn foo(iter: Vec<Result<HashMap<String, String>, std::io::Error>>) {
    let output = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
}
```

**Before this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_ = HashMap<String, String>>, _ = Error>>().unwrap();
```

**After this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
```
@A4-Tacks A4-Tacks force-pushed the hide-placeholder-hints branch from fa14a7f to e8ee597 Compare December 4, 2025 18:10
@A4-Tacks
Copy link
Member Author

A4-Tacks commented Dec 4, 2025

I think I prefer the phrase to be positive, all other configs are this way.

There are already hideClosureInitialization, hideClosureParameter, and hideNamedConstructor, perhaps it would be better to maintain the same style with the hide prefix?

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Dec 4, 2025
Merged via the queue into rust-lang:master with commit d4f45d7 Dec 4, 2025
16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2025
@A4-Tacks A4-Tacks deleted the hide-placeholder-hints branch December 4, 2025 22:18
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.

3 participants