Merge pull request #18809 from Veykril/push-ktwrzsmzlplw

internal: Do not render closure ids in hover messages
This commit is contained in:
Lukas Wirth 2025-01-01 12:55:37 +00:00 committed by GitHub
commit e5950cd41d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 9 deletions

View file

@ -890,12 +890,11 @@ fn closure_ty(
} else {
String::new()
};
let mut markup = format!("```rust\n{}", c.display_with_id(sema.db, edition));
let mut markup = format!("```rust\n{}\n```", c.display_with_impl(sema.db, edition));
if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) {
push_new_def(hir::Trait::from(trait_).into())
}
format_to!(markup, "\n{}\n```", c.display_with_impl(sema.db, edition),);
if let Some(layout) =
render_memory_layout(config.memory_layout, || original.layout(sema.db), |_| None, |_| None)
{

View file

@ -348,7 +348,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```
___
@ -372,7 +371,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```
___
@ -407,7 +405,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl FnOnce()
```
___
@ -437,7 +434,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl FnMut()
```
___
@ -463,7 +459,6 @@ fn main() {
"#,
expect![[r#"
```rust
{closure#0}
impl FnOnce() -> S2
```
___
@ -3017,7 +3012,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```

View file

@ -61,7 +61,6 @@ pub(super) fn hints(
}
hint.label.append_str(r);
});
hint.pad_right = was_mut_last;
let acc_base = acc.len();
match pat {
ast::Pat::IdentPat(pat) if pat.ref_token().is_none() && pat.mut_token().is_none() => {
@ -86,6 +85,7 @@ pub(super) fn hints(
}
ast::Pat::OrPat(pat) if !pattern_adjustments.is_empty() && outer_paren_pat.is_none() => {
hint.label.append_str("(");
was_mut_last = false;
acc.push(InlayHint::closing_paren_after(
InlayKind::BindingMode,
pat.syntax().text_range(),
@ -94,6 +94,7 @@ pub(super) fn hints(
_ => (),
}
if !hint.label.parts.is_empty() {
hint.pad_right = was_mut_last;
acc.push(hint);
}