aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/display/short_label.rs10
-rw-r--r--crates/ra_ide/src/hover.rs8
2 files changed, 13 insertions, 5 deletions
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index b5ff9fa2d..d8acb3be7 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -61,7 +61,15 @@ impl ShortLabel for ast::TypeAlias {
61 61
62impl ShortLabel for ast::Const { 62impl ShortLabel for ast::Const {
63 fn short_label(&self) -> Option<String> { 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
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 9c7348898..f66f62bfb 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -590,16 +590,16 @@ fn main() {
590 #[test] 590 #[test]
591 fn hover_const_static() { 591 fn hover_const_static() {
592 check( 592 check(
593 r#"const foo<|>: u32 = 0;"#, 593 r#"const foo<|>: u32 = 123;"#,
594 expect![[r#" 594 expect![[r#"
595 *foo* 595 *foo*
596 ```rust 596 ```rust
597 const foo: u32 597 const foo: u32 = 123
598 ``` 598 ```
599 "#]], 599 "#]],
600 ); 600 );
601 check( 601 check(
602 r#"static foo<|>: u32 = 0;"#, 602 r#"static foo<|>: u32 = 456;"#,
603 expect![[r#" 603 expect![[r#"
604 *foo* 604 *foo*
605 ```rust 605 ```rust
@@ -834,7 +834,7 @@ fn main() {
834 expect![[r#" 834 expect![[r#"
835 *C* 835 *C*
836 ```rust 836 ```rust
837 const C: u32 837 const C: u32 = 1
838 ``` 838 ```
839 "#]], 839 "#]],
840 ) 840 )