diff options
author | JmPotato <[email protected]> | 2020-08-10 10:51:45 +0100 |
---|---|---|
committer | JmPotato <[email protected]> | 2020-08-10 10:51:45 +0100 |
commit | 958b91c1e8394129216d1b8378d726f937592d3f (patch) | |
tree | d9eb3f88c60add9d7bfc050c8fb52f2033e238cb | |
parent | 4d9c8821e5c328f29b77667c86cabb3689947fd2 (diff) |
Better codes
Signed-off-by: JmPotato <[email protected]>
-rw-r--r-- | crates/ra_ide/src/display/short_label.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index d8acb3be7..010c34705 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -61,15 +61,11 @@ impl ShortLabel for ast::TypeAlias { | |||
61 | 61 | ||
62 | impl ShortLabel for ast::Const { | 62 | impl ShortLabel for ast::Const { |
63 | fn short_label(&self) -> Option<String> { | 63 | fn short_label(&self) -> Option<String> { |
64 | match short_label_from_ty(self, self.ty(), "const ") { | 64 | let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?; |
65 | Some(buf) => { | 65 | if let Some(expr) = self.body() { |
66 | let mut new_buf = buf; | 66 | format_to!(new_buf, " = {}", expr.syntax()); |
67 | let body = self.body().unwrap(); | ||
68 | format_to!(new_buf, " = {}", body.syntax()); | ||
69 | Some(new_buf) | ||
70 | } | ||
71 | None => None, | ||
72 | } | 67 | } |
68 | Some(new_buf) | ||
73 | } | 69 | } |
74 | } | 70 | } |
75 | 71 | ||