Skip to content

Commit 958b91c

Browse files
committed
Better codes
Signed-off-by: JmPotato <[email protected]>
1 parent 4d9c882 commit 958b91c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

crates/ra_ide/src/display/short_label.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,11 @@ impl ShortLabel for ast::TypeAlias {
6161

6262
impl ShortLabel for ast::Const {
6363
fn short_label(&self) -> Option<String> {
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,
64+
let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?;
65+
if let Some(expr) = self.body() {
66+
format_to!(new_buf, " = {}", expr.syntax());
7267
}
68+
Some(new_buf)
7369
}
7470
}
7571

0 commit comments

Comments
 (0)