diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index d8acb3be764..010c34705c7 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -61,15 +61,11 @@ fn short_label(&self) -> Option { impl ShortLabel for ast::Const { fn short_label(&self) -> Option { - match short_label_from_ty(self, self.ty(), "const ") { - Some(buf) => { - let mut new_buf = buf; - let body = self.body().unwrap(); - format_to!(new_buf, " = {}", body.syntax()); - Some(new_buf) - } - None => None, + let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?; + if let Some(expr) = self.body() { + format_to!(new_buf, " = {}", expr.syntax()); } + Some(new_buf) } }