File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,15 @@ impl ShortLabel for ast::TypeAlias {
61
61
62
62
impl ShortLabel for ast:: Const {
63
63
fn short_label ( & self ) -> Option < String > {
64
- short_label_from_ty ( self , self . ty ( ) , "const " )
64
+ match short_label_from_ty ( self , self . ty ( ) , "const " ) {
65
+ Some ( buf) => {
66
+ let mut new_buf = buf;
67
+ let body = self . body ( ) . unwrap ( ) ;
68
+ format_to ! ( new_buf, " = {}" , body. syntax( ) ) ;
69
+ Some ( new_buf)
70
+ }
71
+ None => None ,
72
+ }
65
73
}
66
74
}
67
75
Original file line number Diff line number Diff line change @@ -590,16 +590,16 @@ fn main() {
590
590
#[ test]
591
591
fn hover_const_static ( ) {
592
592
check (
593
- r#"const foo<|>: u32 = 0 ;"# ,
593
+ r#"const foo<|>: u32 = 123 ;"# ,
594
594
expect ! [ [ r#"
595
595
*foo*
596
596
```rust
597
- const foo: u32
597
+ const foo: u32 = 123
598
598
```
599
599
"# ] ] ,
600
600
) ;
601
601
check (
602
- r#"static foo<|>: u32 = 0 ;"# ,
602
+ r#"static foo<|>: u32 = 456 ;"# ,
603
603
expect ! [ [ r#"
604
604
*foo*
605
605
```rust
@@ -834,7 +834,7 @@ fn main() {
834
834
expect ! [ [ r#"
835
835
*C*
836
836
```rust
837
- const C: u32
837
+ const C: u32 = 1
838
838
```
839
839
"# ] ] ,
840
840
)
You can’t perform that action at this time.
0 commit comments