Skip to content

Commit

Permalink
internal: Do not render closure ids in hover messages
Browse files Browse the repository at this point in the history
They are not useful
  • Loading branch information
Veykril committed Jan 1, 2025
1 parent 204c8d7 commit c95aa86
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/crates/ide/src/hover/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 0 additions & 6 deletions src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```
___
Expand All @@ -372,7 +371,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```
___
Expand Down Expand Up @@ -407,7 +405,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl FnOnce()
```
___
Expand Down Expand Up @@ -437,7 +434,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl FnMut()
```
___
Expand All @@ -463,7 +459,6 @@ fn main() {
"#,
expect![[r#"
```rust
{closure#0}
impl FnOnce() -> S2
```
___
Expand Down Expand Up @@ -3017,7 +3012,6 @@ fn main() {
expect![[r#"
*|*
```rust
{closure#0}
impl Fn(i32) -> i32
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() => {
Expand All @@ -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(),
Expand All @@ -94,6 +94,7 @@ pub(super) fn hints(
_ => (),
}
if !hint.label.parts.is_empty() {
hint.pad_right = was_mut_last;
acc.push(hint);
}

Expand Down

0 comments on commit c95aa86

Please sign in to comment.