Skip to content

Commit e5950cd

Browse files
authored
Merge pull request #18809 from Veykril/push-ktwrzsmzlplw
internal: Do not render closure ids in hover messages
2 parents a612fc9 + 721e43e commit e5950cd

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

crates/ide/src/hover/render.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,11 @@ fn closure_ty(
890890
} else {
891891
String::new()
892892
};
893-
let mut markup = format!("```rust\n{}", c.display_with_id(sema.db, edition));
893+
let mut markup = format!("```rust\n{}\n```", c.display_with_impl(sema.db, edition));
894894

895895
if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) {
896896
push_new_def(hir::Trait::from(trait_).into())
897897
}
898-
format_to!(markup, "\n{}\n```", c.display_with_impl(sema.db, edition),);
899898
if let Some(layout) =
900899
render_memory_layout(config.memory_layout, || original.layout(sema.db), |_| None, |_| None)
901900
{

crates/ide/src/hover/tests.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ fn main() {
348348
expect![[r#"
349349
*|*
350350
```rust
351-
{closure#0}
352351
impl Fn(i32) -> i32
353352
```
354353
___
@@ -372,7 +371,6 @@ fn main() {
372371
expect![[r#"
373372
*|*
374373
```rust
375-
{closure#0}
376374
impl Fn(i32) -> i32
377375
```
378376
___
@@ -407,7 +405,6 @@ fn main() {
407405
expect![[r#"
408406
*|*
409407
```rust
410-
{closure#0}
411408
impl FnOnce()
412409
```
413410
___
@@ -437,7 +434,6 @@ fn main() {
437434
expect![[r#"
438435
*|*
439436
```rust
440-
{closure#0}
441437
impl FnMut()
442438
```
443439
___
@@ -463,7 +459,6 @@ fn main() {
463459
"#,
464460
expect![[r#"
465461
```rust
466-
{closure#0}
467462
impl FnOnce() -> S2
468463
```
469464
___
@@ -3017,7 +3012,6 @@ fn main() {
30173012
expect![[r#"
30183013
*|*
30193014
```rust
3020-
{closure#0}
30213015
impl Fn(i32) -> i32
30223016
```
30233017

crates/ide/src/inlay_hints/binding_mode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub(super) fn hints(
6161
}
6262
hint.label.append_str(r);
6363
});
64-
hint.pad_right = was_mut_last;
6564
let acc_base = acc.len();
6665
match pat {
6766
ast::Pat::IdentPat(pat) if pat.ref_token().is_none() && pat.mut_token().is_none() => {
@@ -86,6 +85,7 @@ pub(super) fn hints(
8685
}
8786
ast::Pat::OrPat(pat) if !pattern_adjustments.is_empty() && outer_paren_pat.is_none() => {
8887
hint.label.append_str("(");
88+
was_mut_last = false;
8989
acc.push(InlayHint::closing_paren_after(
9090
InlayKind::BindingMode,
9191
pat.syntax().text_range(),
@@ -94,6 +94,7 @@ pub(super) fn hints(
9494
_ => (),
9595
}
9696
if !hint.label.parts.is_empty() {
97+
hint.pad_right = was_mut_last;
9798
acc.push(hint);
9899
}
99100

0 commit comments

Comments
 (0)